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

Function ToString

pkg/attribute/attribute.go:134–145  ·  view source on GitHub ↗

ToString function takes an Attribute object and converts it into a string.

(attribute *base.Attribute)

Source from the content-addressed store, hash-verified

132
133// ToString function takes an Attribute object and converts it into a string.
134func ToString(attribute *base.Attribute) string {
135 // Get the entity from the attribute
136 entity := attribute.GetEntity()
137
138 // Convert the entity to string
139 strEntity := EntityToString(entity)
140
141 // Create the string representation of the attribute
142 result := fmt.Sprintf("%s$%s|%s:%s", strEntity, attribute.GetAttribute(), TypeUrlToString(attribute.GetValue().GetTypeUrl()), AnyToString(attribute.GetValue()))
143
144 return result
145}
146
147// EntityAndAttributeToString converts an entity and attribute to a single string.
148func EntityAndAttributeToString(entity *base.Entity, attr string) string {

Callers 2

ContextToStringFunction · 0.92
attribute_test.goFile · 0.70

Calls 6

TypeUrlToStringFunction · 0.85
AnyToStringFunction · 0.85
EntityToStringFunction · 0.70
GetEntityMethod · 0.45
GetAttributeMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected