Documentation
¶
Index ¶
- func ConvertUnmarshallingError(err error) error
- func Unmarshal(data []byte, dest interface{}) error
- func UnmarshalDecoder(d *json.Decoder, dest interface{}) error
- func UnmarshalReader(r io.Reader, dest interface{}) error
- func Validate(value interface{}) error
- type Validatable
- type ValidationError
- type ValidationErrors
- type Validator
- func (v *Validator) AddError(token interface{}, code, format string, args ...interface{})
- func (v *Validator) Check(token interface{}, value bool, code, format string, args ...interface{}) bool
- func (v *Validator) CheckIntMax(token interface{}, i int, max int) bool
- func (v *Validator) CheckIntMin(token interface{}, i int, min int) bool
- func (v *Validator) CheckIntMinMax(token interface{}, i int, min, max int) bool
- func (v *Validator) CheckObject(token interface{}, value interface{}) bool
- func (v *Validator) CheckOptionalObject(token interface{}, value interface{}) bool
- func (v *Validator) CheckStringLengthMax(token interface{}, s string, max int) bool
- func (v *Validator) CheckStringLengthMin(token interface{}, s string, min int) bool
- func (v *Validator) CheckStringLengthMinMax(token interface{}, s string, min, max int) bool
- func (v *Validator) CheckStringMatch(token interface{}, s string, re *regexp.Regexp) bool
- func (v *Validator) CheckStringMatch2(token interface{}, s string, re *regexp.Regexp, code, format string, ...) bool
- func (v *Validator) CheckStringNotEmpty(token interface{}, s string) bool
- func (v *Validator) CheckStringURI(token interface{}, s string) bool
- func (v *Validator) Error() ValidationErrors
- func (v *Validator) Pop()
- func (v *Validator) Push(token interface{})
- func (v *Validator) WithChild(token interface{}, fn func())
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UnmarshalDecoder ¶
func UnmarshalReader ¶
Types ¶
type Validatable ¶
type Validatable interface {
ValidateJSON(v *Validator)
}
type ValidationError ¶
type ValidationError struct { Pointer jsonpointer.Pointer `json:"pointer"` Code string `json:"code"` Message string `json:"message"` }
func (ValidationError) Error ¶
func (err ValidationError) Error() string
type ValidationErrors ¶
type ValidationErrors []*ValidationError
func (ValidationErrors) Error ¶
func (errs ValidationErrors) Error() string
type Validator ¶
type Validator struct { Pointer jsonpointer.Pointer Errors ValidationErrors }
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) CheckIntMax ¶
func (*Validator) CheckIntMin ¶
func (*Validator) CheckIntMinMax ¶
func (*Validator) CheckObject ¶
func (*Validator) CheckOptionalObject ¶
func (*Validator) CheckStringLengthMax ¶
func (*Validator) CheckStringLengthMin ¶
func (*Validator) CheckStringLengthMinMax ¶
func (*Validator) CheckStringMatch ¶
func (*Validator) CheckStringMatch2 ¶
func (*Validator) CheckStringNotEmpty ¶
func (*Validator) CheckStringURI ¶
func (*Validator) Error ¶
func (v *Validator) Error() ValidationErrors
Click to show internal directories.
Click to hide internal directories.