Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrValidation = errors.New("validation_failed")
ErrValidation is returned when validation fails.
Functions ¶
func ValidateEmail ¶
Email is a validator that checks if the value is a valid email address.
func ValidateSolanaWalletAddr ¶
ValidateSolanaWalletAddr validates a Solana wallet address. Returns an error if the address is invalid, nil otherwise.
func ValidateStruct ¶
ValidateStruct validate struct data - s: struct pointer - return: validation errors as url.Values or nil if no errors
Types ¶
type EmailAddress ¶
type EmailAddress struct { // LocalPart usually the username of an email address. LocalPart string // Domain is the part of the email address after the last @. // This should be DNS resolvable to an email server. Domain string }
EmailAddress is a structure that stores the address local-part@domain parts.
func (EmailAddress) String ¶
func (e EmailAddress) String() string
func (EmailAddress) ValidateHost ¶
func (e EmailAddress) ValidateHost() error
ValidateHost will test if the email address is actually reachable. It will first try to resolve the host and then start a mail transaction.
func (EmailAddress) ValidateIcanSuffix ¶
func (e EmailAddress) ValidateIcanSuffix() error
ValidateIcanSuffix will test if the public suffix of the domain is managed by ICANN using the golang.org/x/net/publicsuffix package. If not it will return an error. Note that if this method returns an error it does not necessarily mean that the email address is invalid. Also the suffix list in the standard package is embedded and thereby not up to date.
type ValidationError ¶
type ValidationError struct { Err error // The underlying error. Values url.Values // A map of field names to error messages. }
ValidationError is a custom error type that contains a map of field names to error messages.
func NewValidationError ¶
func NewValidationError(values url.Values) *ValidationError
NewValidationError returns a new ValidationError.
func (*ValidationError) AddValue ¶
func (e *ValidationError) AddValue(key, message string) *ValidationError
AddValue adds a new error message to the map.
func (*ValidationError) AddValues ¶
func (e *ValidationError) AddValues(values url.Values) *ValidationError
AddValues adds a new error message to the map.
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
Error returns the error message.
func (*ValidationError) Unwrap ¶
func (e *ValidationError) Unwrap() error
Unwrap returns the underlying error.