Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Check = rule("check") RoleRange = rule("rolerange") )
View Source
var ErrInvalidInput = fmt.Errorf("invalid input")
Functions ¶
Types ¶
type Client ¶
type Client interface {
Register(r Rule, fn ValidatorFunc)
Validate(key string, v any) error
}
type RangeOption ¶
type RangeOption func(*RangeOptions)
func WithMax ¶
func WithMax(max float64) RangeOption
func WithMin ¶
func WithMin(min float64) RangeOption
type RangeOptions ¶
func ApplyRangeOptions ¶
func ApplyRangeOptions(opts *RangeOptions, modifiers ...RangeOption) RangeOptions
type RequireOption ¶
type RequireOption func(*RequireOptions)
func WithNonNilPointer ¶
func WithNonNilPointer() RequireOption
func WithNonZeroValue ¶
func WithNonZeroValue() RequireOption
type RequireOptions ¶
func ApplyRequireOptions ¶
func ApplyRequireOptions(opts *RequireOptions, modifiers ...RequireOption) RequireOptions
type ValidatorFunc ¶
func InRange ¶
func InRange(opts RangeOptions) ValidatorFunc
InRange returns a ValidatorFunc that requires the value to be within the specified range.
func Require ¶
func Require(opts RequireOptions) ValidatorFunc
Require returns a ValidatorFunc that requires the value to not be nil or zero.
func RequireBCP47 ¶
func RequireBCP47() ValidatorFunc
RequireBCP47 returns a ValidatorFunc that requires the value to be a valid BCP47 language tag.
func RequireE164Phone ¶
func RequireE164Phone() ValidatorFunc
RequireE164Phone returns a ValidatorFunc that requires the value to be a valid E.164 phone number.
func RequireISOCurrency ¶
func RequireISOCurrency() ValidatorFunc
RequireISOCurrency returns a ValidatorFunc that requires the value to be a valid ISO 4217 currency code.
func RequireUTCDate ¶
func RequireUTCDate() ValidatorFunc
RequireUTCDate returns a ValidatorFunc that requires the value to be a valid UTC date.
Click to show internal directories.
Click to hide internal directories.