Documentation
¶
Index ¶
- func Validate(ctx context.Context, values map[string]any, validators ...Validator) error
- type Error
- type Errors
- type Validator
- func Choice(field string, choices ...any) Validator
- func Constraint(field string, check func(context.Context, map[string]any) (bool, error)) Validator
- func Custom(field, code string, check func(context.Context, any) error) Validator
- func Email(field string) Validator
- func FieldLevel(field string, check func(context.Context, any) error) Validator
- func MaxLength(field string, max int) Validator
- func MaxValue(field string, max float64) Validator
- func MinLength(field string, min int) Validator
- func MinValue(field string, min float64) Validator
- func ModelLevel(code string, check func(context.Context, map[string]any) error) Validator
- func Regex(field string, pattern *regexp.Regexp) Validator
- func Required(field string) Validator
- func Slug(field string) Validator
- func Type(field string, example any) Validator
- func URL(field string) Validator
- func UUID(field string) Validator
- func Unique(field string, check func(context.Context, any) (bool, error)) Validator
- func UniqueForDate(field string, check func(context.Context, time.Time, any) (bool, error)) Validator
- func UniqueForMonth(field string, check func(context.Context, time.Time, any) (bool, error)) Validator
- func UniqueForYear(field string, check func(context.Context, time.Time, any) (bool, error)) Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Validator ¶
Validator validates a value map and appends structured errors.
func Constraint ¶
func ModelLevel ¶
func UniqueForDate ¶
func UniqueForMonth ¶
Click to show internal directories.
Click to hide internal directories.