Documentation ¶
Index ¶
- Variables
- func IsISO8601Date(fl validator.FieldLevel) bool
- func IsNumber(fl validator.FieldLevel) bool
- func IsObject(fl validator.FieldLevel) bool
- func Pattern(val string) *string
- func RegisterCustomValidations(validator *validator.Validate)
- type FieldError
- type FieldPath
- type FieldSchema
- type FieldsArray
- type MapField
- type Rule
- type Rules
- type RulesMap
- type SchemaValidator
- type SliceField
- type TreeField
- type ValidationErrors
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrInvalidJSON = errors.New("invalid json")
)
Functions ¶
func IsISO8601Date ¶
func IsISO8601Date(fl validator.FieldLevel) bool
func RegisterCustomValidations ¶ added in v0.2.2
func RegisterCustomValidations(validator *validator.Validate)
Types ¶
type FieldError ¶
type FieldError struct { Field string Rule string Value interface{} Accepted string ValidationErrors validator.ValidationErrors }
func (FieldError) Error ¶
func (v FieldError) Error() string
type FieldSchema ¶
type FieldSchema struct { Type string Name string Value interface{} Rule Rule Rules Rules Properties MapField Items FieldsArray }
func (*FieldSchema) IsRequired ¶
func (f *FieldSchema) IsRequired() bool
func (*FieldSchema) UnmarshalJSON ¶
func (f *FieldSchema) UnmarshalJSON(data []byte) error
type FieldsArray ¶
type FieldsArray []MapField
func (FieldsArray) Get ¶
func (f FieldsArray) Get(index int) *FieldSchema
type MapField ¶
type MapField map[string]FieldSchema
func (MapField) Get ¶
func (m MapField) Get(index string) FieldSchema
type SchemaValidator ¶
type SchemaValidator struct {
// contains filtered or unexported fields
}
func NewSchemaValidator ¶
func (*SchemaValidator) AddRule ¶
func (s *SchemaValidator) AddRule(path string, rule string, pattern *string)
func (*SchemaValidator) GetRule ¶
func (s *SchemaValidator) GetRule(path []string) *Rule
func (*SchemaValidator) HasRule ¶
func (s *SchemaValidator) HasRule(path []string) bool
func (*SchemaValidator) Validate ¶
func (s *SchemaValidator) Validate() error
type SliceField ¶
type SliceField interface {
Get(index string) interface{}
}
type ValidationErrors ¶
type ValidationErrors map[string][]FieldError
func (ValidationErrors) Error ¶
func (vErrors ValidationErrors) Error() string
Click to show internal directories.
Click to hide internal directories.