AddAttributeReferences sets references for an attribute with its type.
(key string, typ AttributeTypeStatement)
| 106 | |
| 107 | // AddAttributeReferences sets references for an attribute with its type. |
| 108 | func (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. |
no test coverage detected