Documentation ¶
Overview ¶
Package validator provides a set of utilities for validating data, including email validation, uniqueness checks, and permitted value checks. It is taken from "Let's Go " by Alex Edwards.
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])?)*$")
)
EmailRX is a regular expression for validating email addresses.
Functions ¶
func PermittedValue ¶
func PermittedValue[T comparable](value T, permittedValues ...T) bool
PermittedValue checks if a value is within a set of permitted values.
func Unique ¶
func Unique[T comparable](values []T) bool
Unique checks if all values in a slice are unique.
Types ¶
Click to show internal directories.
Click to hide internal directories.