MCPcopy Create free account
hub / github.com/Permify/permify / RelationReference

Function RelationReference

pkg/tuple/tuple.go:245–261  ·  view source on GitHub ↗

RelationReference parses a relation reference string and returns a RelationReference object.

(ref string)

Source from the content-addressed store, hash-verified

243
244// RelationReference parses a relation reference string and returns a RelationReference object.
245func 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
264func AreRelationReferencesEqual(s1, s2 *base.RelationReference) bool {

Callers 7

notion_test.goFile · 0.92
RunWithShapeMethod · 0.92
validateFunction · 0.92
lookup_test.goFile · 0.92
tuple_test.goFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected