Documentation ¶
Index ¶
- Variables
- func MaxLengthRule(length int) maxLength
- func MinLengthRule(length int) minLength
- func PasswordMatchConfirmRule(confirm string) passwordMatchConfirm
- func ValidateStruct(structToValidate any, validationMap map[string][]Rule) error
- type Error
- type Rule
- type ValidationError
- type ValidationErrors
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidEmail = errors.New("provided email is invalid") ErrInvalidUsername = errors.New("provided username is invalid") ErrIsRequired = errors.New("value is required") ErrValueTooShort = errors.New("value is too short") ErrValueTooLong = errors.New("value is too long") ErrPasswordDontMatchConfirm = errors.New("the two passwords must match") )
View Source
var RequiredRule required
View Source
var ValidEmailRule validEmail
Functions ¶
func MaxLengthRule ¶
func MaxLengthRule(length int) maxLength
func MinLengthRule ¶
func MinLengthRule(length int) minLength
func PasswordMatchConfirmRule ¶
func PasswordMatchConfirmRule(confirm string) passwordMatchConfirm
Types ¶
type Error ¶
func (Error) GetFieldName ¶
func (Error) GetFieldValue ¶
func (Error) GetHumanExplanations ¶
func (Error) GetViolations ¶
type ValidationError ¶
type ValidationErrors ¶
type ValidationErrors []ValidationError
func (ValidationErrors) Error ¶
func (ve ValidationErrors) Error() string
func (ValidationErrors) Unwrap ¶
func (ve ValidationErrors) Unwrap() []error
Unwrap() is used to make testing easier for now
Click to show internal directories.
Click to hide internal directories.