mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
23 lines
455 B
Go
23 lines
455 B
Go
|
package service
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
|
||
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
||
|
"github.com/grafana/grafana/pkg/services/publicdashboards/models"
|
||
|
)
|
||
|
|
||
|
func UnmarshalDashboardAnnotations(sj *simplejson.Json) (*models.AnnotationsDto, error) {
|
||
|
bytes, err := sj.MarshalJSON()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
dto := &models.AnnotationsDto{}
|
||
|
err = json.Unmarshal(bytes, dto)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return dto, err
|
||
|
}
|