Chore: Replace entity GRN with infra/grn GRN (#74198)

replace entity GRN with infra/grn GRN
This commit is contained in:
Dan Cech
2023-08-31 15:43:35 -04:00
committed by GitHub
parent 27c4362135
commit 85a207fceb
24 changed files with 983 additions and 843 deletions
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"github.com/grafana/grafana/pkg/infra/grn"
"github.com/grafana/grafana/pkg/services/sqlstore/session"
"github.com/grafana/grafana/pkg/services/store/entity"
)
@@ -140,12 +141,12 @@ func setMPTTOrder(folder *folderInfo, stack []*folderInfo, idx int32) (int32, er
func insertFolderInfo(ctx context.Context, tx *session.SessionTx, tenant int64, folder *folderInfo, isDetached bool) error {
js, _ := json.Marshal(folder.stack)
grn := entity.GRN{TenantId: tenant, Kind: entity.StandardKindFolder, UID: folder.UID}
grn2 := grn.GRN{TenantID: tenant, ResourceKind: entity.StandardKindFolder, ResourceIdentifier: folder.UID}
_, err := tx.Exec(ctx,
`INSERT INTO entity_folder `+
"(grn, tenant_id, uid, slug_path, tree, depth, left, right, detached) "+
`VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`,
grn.ToGRNString(),
grn2.ToGRNString(),
tenant,
folder.UID,
folder.Slug,