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

Method AddAttributeReferences

pkg/dsl/ast/references.go:108–118  ·  view source on GitHub ↗

AddAttributeReferences sets references for an attribute with its type.

(key string, typ AttributeTypeStatement)

Source from the content-addressed store, hash-verified

106
107// AddAttributeReferences sets references for an attribute with its type.
108func (refs *References) AddAttributeReferences(key string, typ AttributeTypeStatement) error {
109 if key == "" { // Validate attribute key
110 return fmt.Errorf("key cannot be empty")
111 }
112 if refs.IsReferenceExist(key) {
113 return fmt.Errorf("reference %s already exists", key)
114 }
115 refs.attributeReferences[key] = typ
116 refs.references[key] = ATTRIBUTE
117 return nil
118}
119
120// UpdateRelationReferences updates the relationship references for a given key.
121// It replaces the existing relation types with the new ones provided.

Callers 2

AddStatementMethod · 0.80

Calls 1

IsReferenceExistMethod · 0.95

Tested by

no test coverage detected