RelationReference parses a relation reference string and returns a RelationReference object.
(ref string)
| 243 | |
| 244 | // RelationReference parses a relation reference string and returns a RelationReference object. |
| 245 | func RelationReference(ref string) *base.RelationReference { |
| 246 | // Split the reference string by "#" |
| 247 | sp := strings.Split(ref, "#") |
| 248 | |
| 249 | // Create a new RelationReference with the parsed Type |
| 250 | relationReference := &base.RelationReference{ |
| 251 | Type: sp[0], |
| 252 | } |
| 253 | |
| 254 | // If there is a second part (Relation), add it to RelationReference |
| 255 | if len(sp) > 1 { |
| 256 | relationReference.Relation = sp[1] |
| 257 | } |
| 258 | |
| 259 | // Return the created RelationReference or an error if any step failed |
| 260 | return relationReference |
| 261 | } |
| 262 | |
| 263 | // AreRelationReferencesEqual checks if two relation references are equal or not |
| 264 | func AreRelationReferencesEqual(s1, s2 *base.RelationReference) bool { |
no outgoing calls
no test coverage detected