An idiomatic Go (golang) validation package. Supports configurable and extensible validation rules (validators) using normal language constructs instead of error-prone struct tags.
RuneLength
validation rule to support validating the rune length of a stringFixes #29: Added support for differentiating internal errors from validation errors.
This release revamps the way of declaring struct validation rules, based on the discussion in #12. It introduces BC-breaking changes. Please refer to the upgrade instructions for more details.
The following changes are introduced in this major release:
Errors.Filter()
to support composing arbitrary validation errors.Range
rule with two new rules: Min
and Max
.validation.By()
to support wrapping a function into a validation rule.govalidator
with github.com/asaskevich/govalidator
Date
validator.context
parameter from the Rule.Validate()
interface method. This is BC-breaking change. If your particular rule relies on the struct context, you may define it as a closure or pass the context during the rule creation.