Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Validate = rule("validate") RoleRange = rule("rolerange") NonNilPtr = rule("nnpt") NonZero = rule("nz") IsUTC = rule("utc") DayRange = rule("dayrange") MonthRange = rule("monthrange") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type DefaultTool ¶ added in v0.1.11
func NewTool ¶
func NewTool(client Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) Register ¶ added in v0.1.11
func (d *DefaultTool) Register(ctx context.Context, r Rule, fn ValidatorFunc) error
Register registers a validator function with the given rule.
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 meet the specified conditions.
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.