Documentation ¶
Index ¶
- Constants
- func GenerateIDToFull(groups []*models.Group) map[uint]*Full
- func GenerateIDToGroup(groups []*models.Group) map[uint]*models.Group
- type Child
- func ConvertApplicationToChild(app *appmodels.Application, full *Full) *Child
- func ConvertClusterToChild(cluster *clustermodels.Cluster, full *Full) *Child
- func ConvertGroupOrApplicationToChild(groupOrApplication *models.GroupOrApplication, full *Full) *Child
- func ConvertGroupToChild(group *models.Group, full *Full) *Child
- func ConvertReleaseToChild(release *trmodels.TemplateRelease, full *Full) *Child
- func ConvertTemplateToChild(template *tmodels.Template, full *Full) *Child
- type Full
- type Service
Constants ¶
View Source
const ( // ChildTypeGroup used to indicate the 'Child' is a group ChildTypeGroup = "group" // ChildTypeApplication ... ChildTypeApplication = "application" // ChildTypeCluster ... ChildTypeCluster = "cluster" ChildTypeTemplate = "template" ChildTypeRelease = "release" // RootGroupID id of the root group, which is not actually exists in the group table RootGroupID = 0 )
Variables ¶
This section is empty.
Functions ¶
func GenerateIDToFull ¶
GenerateIDToFull assuming we have 3 groups, group one: {id: 1, name: "a", path: "w"} group two: {id: 2, name: "b", path: "r"} group three: {id: 3, name: "c", path: "j"}
after the function executed, we get a map:
{ 1: { fullName: "a", fullPath: "/w" }, 2: { fullName: "a/b", fullPath: "/w/r" }, 3: { fullName: "a/b/c", fullPath: "/w/r/j" }, }
Types ¶
type Child ¶
type Child struct { ID uint `json:"id"` Name string `json:"name"` Path string `json:"path"` VisibilityLevel string `json:"visibilityLevel"` Description string `json:"description"` ParentID uint `json:"parentID"` TraversalIDs string `json:"traversalIDs"` UpdatedAt time.Time `json:"updatedAt"` FullName string `json:"fullName"` FullPath string `json:"fullPath"` Type string `json:"type"` ChildrenCount int `json:"childrenCount"` Children []*Child `json:"children"` }
Child subResource of a group, including group & application
func ConvertApplicationToChild ¶
func ConvertApplicationToChild(app *appmodels.Application, full *Full) *Child
func ConvertClusterToChild ¶
func ConvertClusterToChild(cluster *clustermodels.Cluster, full *Full) *Child
func ConvertGroupOrApplicationToChild ¶
func ConvertGroupOrApplicationToChild(groupOrApplication *models.GroupOrApplication, full *Full) *Child
ConvertGroupOrApplicationToChild format Child based on groupOrApplication
func ConvertGroupToChild ¶
ConvertGroupToChild format Child based on group model、fullName、fullPath and resourceType
func ConvertReleaseToChild ¶
func ConvertReleaseToChild(release *trmodels.TemplateRelease, full *Full) *Child
type Full ¶
Full is the fullName&fullPath for a group/application/applicationInstance
func GenerateFullFromGroups ¶
GenerateFullFromGroups generate fullPath which looks like /a/b/c, and fullName which looks like 1 / 2
type Service ¶
type Service interface { // GetChildByID get a child by id GetChildByID(ctx context.Context, id uint) (*Child, error) // GetChildrenByIDs returns children map according to group ids GetChildrenByIDs(ctx context.Context, ids []uint) (map[uint]*Child, error) }
func NewService ¶
func NewService(manager *managerparam.Manager) Service
Click to show internal directories.
Click to hide internal directories.