Documentation ¶
Index ¶
- Variables
- func AsArray(v interface{}) []interface{}
- func AsBoolean(v interface{}) bool
- func AsNumber(v interface{}) float64
- func AsObject(v interface{}) map[string]interface{}
- func AsString(v interface{}) string
- func ConvertUnmarshallingError(err error) error
- func Equal(v1, v2 interface{}) bool
- func IsArray(v interface{}) bool
- func IsBoolean(v interface{}) bool
- func IsNull(v interface{}) bool
- func IsNumber(v interface{}) bool
- func IsObject(v interface{}) bool
- func IsString(v interface{}) bool
- func ObjectKeys(v interface{}) []string
- func ObjectValues(v interface{}) []interface{}
- 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 InvalidValueError
- type Pointer
- func (p *Pointer) Append(tokens ...string)
- func (p Pointer) Child(tokens ...interface{}) Pointer
- func (p Pointer) Find(value interface{}) interface{}
- func (p Pointer) MarshalJSON() ([]byte, error)
- func (p *Pointer) MustParse(s string)
- func (p Pointer) Parent() Pointer
- func (p *Pointer) Parse(s string) error
- func (p *Pointer) Prepend(tokens ...string)
- func (p Pointer) String() string
- func (p *Pointer) UnmarshalJSON(data []byte) 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) CheckArrayLengthMax(token interface{}, value interface{}, max int) bool
- func (v *Validator) CheckArrayLengthMin(token interface{}, value interface{}, min int) bool
- func (v *Validator) CheckArrayLengthMinMax(token interface{}, value interface{}, min, max int) bool
- func (v *Validator) CheckArrayNotEmpty(token interface{}, value interface{}) bool
- func (v *Validator) CheckDomainName(token any, s string)
- func (v *Validator) CheckEmailAddress(token any, s string)
- func (v *Validator) CheckFloatMax(token interface{}, i, max float64) bool
- func (v *Validator) CheckFloatMin(token interface{}, i, min float64) bool
- func (v *Validator) CheckFloatMinMax(token interface{}, i, min, max float64) bool
- func (v *Validator) CheckInt64Max(token interface{}, i, max int64) bool
- func (v *Validator) CheckInt64Min(token interface{}, i, min int64) bool
- func (v *Validator) CheckInt64MinMax(token interface{}, i, min, max int64) 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) CheckNetworkAddress(token any, s string)
- func (v *Validator) CheckObject(token interface{}, value interface{}) bool
- func (v *Validator) CheckObjectArray(token interface{}, value interface{}) bool
- func (v *Validator) CheckObjectMap(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) CheckStringValue(token interface{}, value interface{}, values interface{}) bool
- func (v *Validator) CheckUUID(token interface{}, value interface{}) bool
- func (v *Validator) Error() error
- func (v *Validator) Pop()
- func (v *Validator) Push(token interface{})
- func (v *Validator) WithChild(token interface{}, fn func())
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidPointerFormat = errors.New("invalid format")
Functions ¶
func ObjectKeys ¶
func ObjectKeys(v interface{}) []string
func ObjectValues ¶
func ObjectValues(v interface{}) []interface{}
func UnmarshalDecoder ¶
func UnmarshalReader ¶
Types ¶
type InvalidValueError ¶
type InvalidValueError struct {
Value interface{}
}
func (*InvalidValueError) Error ¶
func (err *InvalidValueError) Error() string
type Pointer ¶
type Pointer []string
func NewPointer ¶
func NewPointer(tokens ...interface{}) Pointer
func (Pointer) MarshalJSON ¶
func (*Pointer) UnmarshalJSON ¶
type Validatable ¶
type Validatable interface {
ValidateJSON(v *Validator)
}
type ValidationError ¶
type ValidationError struct { Pointer 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 Pointer Errors ValidationErrors }
func NewValidator ¶
func NewValidator() *Validator
func (*Validator) CheckArrayLengthMax ¶
func (*Validator) CheckArrayLengthMin ¶
func (*Validator) CheckArrayLengthMinMax ¶
func (*Validator) CheckArrayNotEmpty ¶
func (*Validator) CheckDomainName ¶
func (*Validator) CheckEmailAddress ¶
func (*Validator) CheckFloatMax ¶
func (*Validator) CheckFloatMin ¶
func (*Validator) CheckFloatMinMax ¶
func (*Validator) CheckInt64Max ¶
func (*Validator) CheckInt64Min ¶
func (*Validator) CheckInt64MinMax ¶
func (*Validator) CheckIntMax ¶
func (*Validator) CheckIntMin ¶
func (*Validator) CheckIntMinMax ¶
func (*Validator) CheckNetworkAddress ¶
func (*Validator) CheckObject ¶
func (*Validator) CheckObjectArray ¶
func (*Validator) CheckObjectMap ¶
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) CheckStringValue ¶
Click to show internal directories.
Click to hide internal directories.