AddRule adds the given rule to the manager.
(name string, rule Rule)
| 78 | |
| 79 | // AddRule adds the given rule to the manager. |
| 80 | func (mgr *Manager) AddRule(name string, rule Rule) error { |
| 81 | if _, found := mgr.rules[name]; !found { |
| 82 | mgr.rules[name] = rule |
| 83 | return nil |
| 84 | } |
| 85 | return fmt.Errorf("the rule '%s' has already been added", name) |
| 86 | } |
| 87 | |
| 88 | // AddRuleFromFile adds the given rule to the manager. |
| 89 | func (mgr *Manager) AddRuleFromFile(name, path string) error { |