validateRuleBasics checks that the rule has a valid name and at least one criterion. Parameters: - rule: The rule to validate. Returns an error if the rule is missing required fields.
(rule *model.MatchingRule)
| 1216 | // - rule: The rule to validate. |
| 1217 | // Returns an error if the rule is missing required fields. |
| 1218 | func (s *LedgerForge) validateRuleBasics(rule *model.MatchingRule) error { |
| 1219 | if rule.Name == "" { |
| 1220 | return errors.New("rule name is required") |
| 1221 | } |
| 1222 | |
| 1223 | if len(rule.Criteria) == 0 { |
| 1224 | return errors.New("at least one matching criteria is required") |
| 1225 | } |
| 1226 | |
| 1227 | return nil |
| 1228 | } |
| 1229 | |
| 1230 | // validateCriteria checks the validity of a criterion, including its field, operator, and drift values. |
| 1231 | // Parameters: |