Documentation ¶
Index ¶
- func Field(field string, rules ...ValidatorFn) fieldValidation
- func Fields(vals ...fieldValidation) fieldValidations
- type Errors
- type ValidatorFn
- func EqualTo(value float64, message ...string) ValidatorFn
- func GreaterThan(value float64, message ...string) ValidatorFn
- func GreaterThanOrEqualTo(value float64, message ...string) ValidatorFn
- func LessThan(value float64, message ...string) ValidatorFn
- func LessThanOrEqualTo(value float64, message ...string) ValidatorFn
- func MatchRegex(re *regexp.Regexp, message ...string) ValidatorFn
- func Matches(field string, message ...string) ValidatorFn
- func MaxLength(max int, message ...string) ValidatorFn
- func MinLength(min int, message ...string) ValidatorFn
- func Required(message ...string) ValidatorFn
- func TimeAfter(u time.Time, message ...string) ValidatorFn
- func TimeAfterOrEqualTo(u time.Time, message ...string) ValidatorFn
- func TimeBefore(u time.Time, message ...string) ValidatorFn
- func TimeBeforeOrEqualTo(u time.Time, message ...string) ValidatorFn
- func TimeEqualTo(u time.Time, message ...string) ValidatorFn
- func ValidUUID(message ...string) ValidatorFn
- func WithinOptions(options []string, message ...string) ValidatorFn
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Field ¶
func Field(field string, rules ...ValidatorFn) fieldValidation
Field validation specifies the rules for that field.
Types ¶
type ValidatorFn ¶
ValidatorFn is a condition that must be satisfied by all values in a specific form field. Otherwise the rule will return an error
func EqualTo ¶
func EqualTo(value float64, message ...string) ValidatorFn
EqualTo function validates that field values are equal to a compared value.
func GreaterThan ¶
func GreaterThan(value float64, message ...string) ValidatorFn
GreaterThan function validates that the field values are greater than a value.
func GreaterThanOrEqualTo ¶
func GreaterThanOrEqualTo(value float64, message ...string) ValidatorFn
GreaterThanOrEqualTo function validates that the field values are greater than or equal to a value.
func LessThan ¶
func LessThan(value float64, message ...string) ValidatorFn
LessThan function validates that the field values are less than a value.
func LessThanOrEqualTo ¶
func LessThanOrEqualTo(value float64, message ...string) ValidatorFn
LessThanOrEqualTo function validates that the field values are less than or equal to a value.
func MatchRegex ¶
func MatchRegex(re *regexp.Regexp, message ...string) ValidatorFn
MatchRegex function validates the form field values with a regular expression.
func Matches ¶
func Matches(field string, message ...string) ValidatorFn
Match function validates the form field values with a string.
func MaxLength ¶
func MaxLength(max int, message ...string) ValidatorFn
MaxLength function validates that the values' lengths are less than or equal to max.
func MinLength ¶
func MinLength(min int, message ...string) ValidatorFn
MinLength function validates that the values' lengths are greater than or equal to min.
func Required ¶
func Required(message ...string) ValidatorFn
Required function validates the form field has no-empty values.
func TimeAfter ¶
func TimeAfter(u time.Time, message ...string) ValidatorFn
TimeAfter function validates that the values are after an specific time.
func TimeAfterOrEqualTo ¶
func TimeAfterOrEqualTo(u time.Time, message ...string) ValidatorFn
TimeAfterOrEqualTo function validates that the values are after or equal to an specific time.
func TimeBefore ¶
func TimeBefore(u time.Time, message ...string) ValidatorFn
TimeBefore function validates that the values are before an specific time.
func TimeBeforeOrEqualTo ¶
func TimeBeforeOrEqualTo(u time.Time, message ...string) ValidatorFn
TimeBeforeOrEqualTo function validates that the values are before or equal to an specific time.
func TimeEqualTo ¶
func TimeEqualTo(u time.Time, message ...string) ValidatorFn
TimeEqualTo function validates that the values are equal an specific time.
func ValidUUID ¶
func ValidUUID(message ...string) ValidatorFn
ValidUUID function validates that the values are valid UUIDs.
func WithinOptions ¶
func WithinOptions(options []string, message ...string) ValidatorFn
WithinOptions function validates that values are in the option list.