chore: move entity models into entity store service (#62145)

This commit is contained in:
Kristin Laemmert
2023-01-25 12:43:22 -05:00
committed by GitHub
parent 046a9bb7c1
commit dd147a3c31
27 changed files with 227 additions and 240 deletions
+8 -8
View File
@@ -4,20 +4,20 @@ import (
"context"
"encoding/json"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/store"
"github.com/grafana/grafana/pkg/services/store/entity"
)
func GetEntityKindInfo() models.EntityKindInfo {
return models.EntityKindInfo{
ID: models.StandardKindJSONObj,
func GetEntityKindInfo() entity.EntityKindInfo {
return entity.EntityKindInfo{
ID: entity.StandardKindJSONObj,
Name: "JSON Object",
Description: "JSON Object",
}
}
func GetEntitySummaryBuilder() models.EntitySummaryBuilder {
return func(ctx context.Context, uid string, body []byte) (*models.EntitySummary, []byte, error) {
func GetEntitySummaryBuilder() entity.EntitySummaryBuilder {
return func(ctx context.Context, uid string, body []byte) (*entity.EntitySummary, []byte, error) {
v := make(map[string]interface{})
err := json.Unmarshal(body, &v)
if err != nil {
@@ -28,8 +28,8 @@ func GetEntitySummaryBuilder() models.EntitySummaryBuilder {
if err != nil {
return nil, nil, err
}
return &models.EntitySummary{
Kind: models.StandardKindJSONObj,
return &entity.EntitySummary{
Kind: entity.StandardKindJSONObj,
Name: store.GuessNameFromUID(uid),
UID: uid,
}, out, err