Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var EmailRX = regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$")
Functions ¶
func PermittedValue ¶
func PermittedValue[T comparable](value T, permittedValues ...T) bool
PermittedValue returns true if the value is in the list of permitted values.
Types ¶
type Validator ¶
Validator is a struct that contains a map of field errors.
func (*Validator) AddFieldError ¶
AddFieldError adds an error message to the map of field errors.
func (*Validator) AddGeneralError ¶
AddGeneralError adds an error message to the slice of general errors.
func (*Validator) CheckField ¶
CheckField checks if a condition is met and adds an error message to the map of field errors if it is not.
Click to show internal directories.
Click to hide internal directories.