Changed definition of storage.CollapseRolesIntoOne and RoleDeepCopy

No more list of pointers/pointer
This commit is contained in:
Melody Becker 2024-11-04 16:24:11 +01:00
parent fc0875e494
commit 92fd3d7f0b

View file

@ -92,9 +92,9 @@ func main() {
// Build role collapse function
outBuilder.WriteString(
`func CollapseRolesIntoOne(roles ...*Role) Role {
startingRole := RoleDeepCopy(&DefaultUserRole)
slices.SortFunc(roles, func(a, b *Role) int { return int(int64(a.Priority)-int64(b.Priority)) })
`func CollapseRolesIntoOne(roles ...Role) Role {
startingRole := RoleDeepCopy(DefaultUserRole)
slices.SortFunc(roles, func(a, b Role) int { return int(int64(a.Priority)-int64(b.Priority)) })
for _, role := range roles {
`)
// Write all the stupid conditions here
@ -119,7 +119,7 @@ func main() {
`)
// Then build the deep copy function
outBuilder.WriteString("\nfunc RoleDeepCopy(o *Role) Role {\n")
outBuilder.WriteString("\nfunc RoleDeepCopy(o Role) Role {\n")
outBuilder.WriteString(` n := Role{}
n.Model = o.Model
n.Name = o.Name