Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLengthNotMultipleOfInvalid = validation.NewError("validation_length_not_multiple_of_invalid", "the length must be a multiple of {{.base}}")
ErrLengthNotMultipleOfInvalid is the error that returns in case of a length that is not multiple of a certain number.
Functions ¶
This section is empty.
Types ¶
type LengthMultipleOfRule ¶
type LengthMultipleOfRule struct {
// contains filtered or unexported fields
}
LengthMultipleOf is a validation rule that checks if a value's length is a multiple of the specified number.
func LengthMultipleOf ¶
func LengthMultipleOf(base int) LengthMultipleOfRule
LengthMultipleOf returns a validation rule that checks if a value's length is a multiple of the specified number. This rule should only be used for validating strings, slices, maps, and arrays. An empty value is considered valid. Use the Required rule to make sure a value is not empty.
func (LengthMultipleOfRule) Error ¶
func (r LengthMultipleOfRule) Error(message string) LengthMultipleOfRule
Error sets the error message for the rule.
func (LengthMultipleOfRule) Validate ¶
func (r LengthMultipleOfRule) Validate(value interface{}) error
Validate checks if the given value is valid or not.
Click to show internal directories.
Click to hide internal directories.