Reference - Reference builder
(name string)
| 163 | |
| 164 | // Reference - Reference builder |
| 165 | func Reference(name string) *base.RelationReference { |
| 166 | // Split the name parameter into a type and relation if it contains a "#" |
| 167 | s := strings.Split(name, "#") |
| 168 | if len(s) == 1 { |
| 169 | // If no relation is specified in the name, return a RelationReference with an empty relation field |
| 170 | return &base.RelationReference{ |
| 171 | Type: s[0], |
| 172 | Relation: "", |
| 173 | } |
| 174 | } |
| 175 | // If a relation is specified in the name, return a RelationReference with both type and relation fields populated |
| 176 | return &base.RelationReference{ |
| 177 | Type: s[0], |
| 178 | Relation: s[1], |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | // Permission - Permission builder creates a new action definition with the given name and child entity |
| 183 | func Permission(name string, child *base.Child) *base.PermissionDefinition { |