Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Validate = rule("validate") Recurse = rule("recurse") NonNilPtr = rule("nnpt") NonZero = rule("nz") UTC = rule("utc") MinuteRange = rule("minuterange") HourRange = rule("hourrange") DayRange = rule("dayrange") MonthRange = rule("monthrange") WeekDayRange = rule("weekdayrange") WeekRange = rule("weekrange") DayInMinutesRange = rule("dayinminutesrange") RGBARange = rule("rgbarange") RoleRange = rule("rolerange") E164 = rule("e164") BCP47 = rule("bcp47") ISOCurrency = rule("isocurrency") Timezone = rule("tz") PercentRange = rule("percentrange") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface {
contract.ValidationOperator
}
func NewClient ¶
func NewClient(opts ClientOptions) (Client, error)
type ClientOption ¶ added in v0.1.338
type ClientOption = contract.Opt[ClientOptions]
func WithToRegister ¶ added in v0.1.338
func WithToRegister(x ToRegister) ClientOption
type ClientOptions ¶ added in v0.1.338
type ClientOptions struct {
T ToRegister
}
func ApplyClientOptions ¶ added in v0.1.338
func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions
type DefaultTool ¶ added in v0.1.11
func NewTool ¶
func NewTool(client Client, opts contract.ToolOptions[Client]) *DefaultTool
func (*DefaultTool) RunGuards ¶ added in v0.1.830
func (d *DefaultTool) RunGuards(ctx context.Context, opts contract.RunGuardsOptions) error
RunGuards executes guard calls in order.
type ToRegister ¶ added in v0.1.338
type ToRegister map[Rule]ValidatorFunc
type ValidatorFunc ¶
func InRange ¶
func InRange(opts contract.RangeOptions) ValidatorFunc
InRange returns a ValidatorFunc that requires the value to be within the specified range.
func Require ¶
func Require(opts contract.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 RequireTimezone ¶ added in v0.1.347
func RequireTimezone() ValidatorFunc
RequireTimezone returns a ValidatorFunc that requires the value to be a valid IANA timezone string.
func RequireUTCDate ¶
func RequireUTCDate() ValidatorFunc
RequireUTCDate returns a ValidatorFunc that requires the value to be a valid UTC date.