AddEntityReference sets a reference for an entity.
(name string)
| 54 | |
| 55 | // AddEntityReference sets a reference for an entity. |
| 56 | func (refs *References) AddEntityReference(name string) error { |
| 57 | if name == "" { // Validate entity name |
| 58 | return fmt.Errorf("name cannot be empty") |
| 59 | } |
| 60 | if refs.IsReferenceExist(name) { |
| 61 | return fmt.Errorf("reference %s already exists", name) |
| 62 | } |
| 63 | refs.entityReferences[name] = struct{}{} |
| 64 | refs.references[name] = ENTITY |
| 65 | return nil |
| 66 | } |
| 67 | |
| 68 | // AddRuleReference sets a reference for a rule. |
| 69 | func (refs *References) AddRuleReference(name string, types map[string]string) error { |
no test coverage detected