validateField checks if the provided field is valid for a matching rule. Parameters: - field: The field to validate. Returns an error if the field is invalid.
(field string)
| 1264 | // - field: The field to validate. |
| 1265 | // Returns an error if the field is invalid. |
| 1266 | func (s *LedgerForge) validateField(field string) error { |
| 1267 | validFields := []string{"amount", "date", "description", "reference", "currency"} |
| 1268 | if !contains(validFields, field) { |
| 1269 | return errors.New("invalid field") |
| 1270 | } |
| 1271 | return nil |
| 1272 | } |
| 1273 | |
| 1274 | // validateDrift checks the allowable drift for the given field and operator. |
| 1275 | // Drift refers to acceptable deviations (e.g., percentage for amounts or seconds for dates). |
no test coverage detected