EntityAPI: Save nested summary info in the SQL database (#61732)

This commit is contained in:
Ryan McKinley
2023-01-21 00:00:17 +00:00
committed by GitHub
parent c4090c579d
commit 624e5dbed2
14 changed files with 486 additions and 168 deletions
@@ -4,6 +4,7 @@ import (
"encoding/json"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/services/store/entity"
)
type summarySupport struct {
@@ -15,6 +16,11 @@ type summarySupport struct {
fields *string
errors *string // should not allow saving with this!
marshaled []byte
// metadata for nested objects
parent_grn *entity.GRN
folder string
isNested bool // set when this is for a nested item
}
func newSummarySupport(summary *models.EntitySummary) (*summarySupport, error) {
@@ -100,3 +106,11 @@ func (s summarySupport) toEntitySummary() (*models.EntitySummary, error) {
}
return summary, err
}
func (s *summarySupport) getParentGRN() *string {
if s.isNested {
t := s.parent_grn.ToGRNString()
return &t
}
return nil
}