Documentation
¶
Index ¶
- Constants
- type Rule
- func Bool() Rule
- func ExactLength(length int) Rule
- func Int() Rule
- func MaxLength(max int) Rule
- func MaxValue[T int | float64](max T) Rule
- func MinLength(min int) Rule
- func MinValue[T int | float64](min T) Rule
- func Required() Rule
- func String() Rule
- func ValidEmail() Rule
- func ValidPhoneNumber() Rule
- func ValidURL() Rule
- type Rules
Constants ¶
View Source
const ( ErrMinLength = "the field '%s' must be greater than %d" ErrMaxLength = "the field '%s' must be less than %d" ErrCannotBeValidatedMin = "the field '%s' cannot be validated with MinLength" ErrCannotBeValidatedMax = "the field '%s' cannot be validated with MaxLength" ErrCannotBeValidatedExactly = "the field '%s' cannot be validated with ExactLength" ErrExactLength = "the field '%s' must have exactly %d" )
View Source
const ( ErrMustBeAnInteger = "the field '%s' must be an integer, but received %v" ErrMinValue = "the field '%s' must be grater than or equal to %v" ErrMaxValue = "the field '%s' must be less than or equal to %v" )
View Source
const ( ErrMustBeAnString = "the field '%s' must be an string, but received '%v'" ErrValidEmail = "the field '%s' is ivalid. '%v'" ErrInvalidPhoneNumber = "the field '%s' is not a valid phone number %v" ErrNonEmptyString = "the field '%s' must be a non-empty string representing a valid URL" ErrInvalidUrl = "the field '%s' is not a valid URL: %s" )
View Source
const ErrMustBeABool = "the field '%s' must be a boolean"
View Source
const ErrRequired = "the field '%s' is required"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Rule ¶
func ExactLength ¶
func ValidEmail ¶
func ValidEmail() Rule
func ValidPhoneNumber ¶
func ValidPhoneNumber() Rule
Click to show internal directories.
Click to hide internal directories.