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])?)*$")
precompile regexps at appilcation start up for better performance
Functions ¶
func PermittedValue ¶
func PermittedValue[T comparable](value T, permittedValues ...T) bool
PermittedValue() returns true if a value is in a list of specific permitted values.
Types ¶
type Validator ¶
func (*Validator) AddFieldError ¶
AddFieldError() adds an error message to the FieldErrors map (so long as no entry already exists for the given key).
func (*Validator) AddNonFieldError ¶
AddNonFieldError() adds an error message to the NonFieldErrors slice
func (*Validator) CheckField ¶
CheckField() adds an error message to the FieldErrors map only if a validation check is not 'ok'.
Click to show internal directories.
Click to hide internal directories.