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

Function ToString

pkg/tuple/tuple.go:87–103  ·  view source on GitHub ↗

ToString function converts a Tuple object to a string format.

(tup *base.Tuple)

Source from the content-addressed store, hash-verified

85
86// ToString function converts a Tuple object to a string format.
87func ToString(tup *base.Tuple) string {
88 // Retrieve the individual elements of the tuple
89 entity := tup.GetEntity()
90 relation := tup.GetRelation()
91 subject := tup.GetSubject()
92
93 // Convert the elements to strings
94 strEntity := EntityToString(entity)
95 strRelation := relation
96 strSubject := SubjectToString(subject)
97
98 // Combine the strings with proper formatting
99 result := fmt.Sprintf("%s#%s@%s", strEntity, strRelation, strSubject)
100
101 // Return the formatted string
102 return result
103}
104
105// IsEntityAndSubjectEquals checks if the entity and subject of a Tuple object are equal
106func IsEntityAndSubjectEquals(t *base.Tuple) bool {

Callers 10

GetNextMethod · 0.92
TestQueryRelationships3Function · 0.92
TestQueryRelationships4Function · 0.92
TestQueryRelationships5Function · 0.92
TestQueryRelationships6Function · 0.92
TestQueryRelationships7Function · 0.92
WriteMethod · 0.92
WriteRelationshipsMethod · 0.92
ContextToStringFunction · 0.92
tuple_test.goFile · 0.70

Calls 5

SubjectToStringFunction · 0.85
EntityToStringFunction · 0.70
GetEntityMethod · 0.45
GetRelationMethod · 0.45
GetSubjectMethod · 0.45

Tested by 5

TestQueryRelationships3Function · 0.74
TestQueryRelationships4Function · 0.74
TestQueryRelationships5Function · 0.74
TestQueryRelationships6Function · 0.74
TestQueryRelationships7Function · 0.74