i got 2 structs sets first: type PermissionsLabels map[string][]PermissionsItem type…
- User
i got 2 structs sets first: type PermissionsLabels map[string][]PermissionsItem
type PermissionsItem struct{ Id string Label string Dependence *string
}second: type PermissionsLabels map[string][]PermissionsItem
type PermissionsItem struct{ Id string
json:"id"Label stringjson:"label"Dependence *stringjson:"dependence,omitempty"continue writing my function: func (c *ctrlImpl) toPermissionsLabels(items *domain.PermissionsLabels) *PermissionsLabels {
codepermissionsLabels := make(PermissionsLabels, len(*items)) for k, item := range *items { permissionsLabels[k] = } return &permissionsLabels}
- Assistant
To complete your
toPermissionsLabelsfunction, you'll need to iterate over theitemsfrom yourdomain.PermissionsLabels, convert eachPermissionsItemto your desired format, and then store the converted results in thepermissionsLabelsmap. Below is a complete implementation of the function based on the provided structs:go