MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / validateRule

Method validateRule

reconciliation.go:1198–1212  ·  view source on GitHub ↗

validateRule validates a matching rule, including checking its basic structure and criteria. Parameters: - rule: The rule to validate. Returns an error if the rule or any of its criteria are invalid.

(rule *model.MatchingRule)

Source from the content-addressed store, hash-verified

1196// - rule: The rule to validate.
1197// Returns an error if the rule or any of its criteria are invalid.
1198func (s *LedgerForge) validateRule(rule *model.MatchingRule) error {
1199 // Validate basic structure of the rule.
1200 if err := s.validateRuleBasics(rule); err != nil {
1201 return err
1202 }
1203
1204 // Validate each individual criterion.
1205 for _, criteria := range rule.Criteria {
1206 if err := s.validateCriteria(criteria); err != nil {
1207 return err
1208 }
1209 }
1210
1211 return nil
1212}
1213
1214// validateRuleBasics checks that the rule has a valid name and at least one criterion.
1215// Parameters:

Callers 2

CreateMatchingRuleMethod · 0.95
UpdateMatchingRuleMethod · 0.95

Calls 2

validateRuleBasicsMethod · 0.95
validateCriteriaMethod · 0.95

Tested by

no test coverage detected