grafana/pkg/services/dashboardversion/dashverimpl/dashver.go

31 lines
642 B
Go
Raw Normal View History

package dashverimpl
import (
"context"
dashver "github.com/grafana/grafana/pkg/services/dashboardversion"
"github.com/grafana/grafana/pkg/services/sqlstore/db"
"github.com/grafana/grafana/pkg/setting"
)
type Service struct {
store store
}
func ProvideService(db db.DB, cfg *setting.Cfg) dashver.Service {
return &Service{
store: &sqlStore{
db: db,
},
}
}
func (s *Service) Get(ctx context.Context, query *dashver.GetDashboardVersionQuery) (*dashver.DashboardVersion, error) {
version, err := s.store.Get(ctx, query)
if err != nil {
return nil, err
}
version.Data.Set("id", version.DashboardID)
return version, nil
}