Documentation
¶
Overview ¶
Code generated by genx:code DO NOT EDIT.
Index ¶
- func DefaultRuleByType(t reflect.Type) string
- func IsValidationError(err error) bool
- func Register(p Provider)
- func UnmarshalDecode(d *jsontext.Decoder, v any, o ...json.Options) error
- func WrapLocationError(err error, location string) error
- func WrapPositionError[Pos ~string](err error, position Pos) error
- type Error
- type LocationError
- type Option
- type PositionError
- type PostValidator
- type Provider
- type TagValidator
- type UnmarshalDecoder
- func Any(rv reflect.Value, va Validator) UnmarshalDecoder
- func Array(rv reflect.Value, va Validator) UnmarshalDecoder
- func Basic(rv reflect.Value, va Validator) UnmarshalDecoder
- func Map(rv reflect.Value, va Validator) UnmarshalDecoder
- func Pointer(rv reflect.Value, va Validator) UnmarshalDecoder
- func Struct(rv reflect.Value, va Validator) UnmarshalDecoder
- func Text(rv reflect.Value, va Validator) UnmarshalDecoder
- func Value(rv reflect.Value, va Validator) UnmarshalDecoder
- type Validator
- type WithDefaults
- type WithElemRule
- type WithKeyRule
- type WithOptional
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultRuleByType ¶
func IsValidationError ¶
func WrapLocationError ¶
Example ¶
wp := WrapPositionError(errors.New("wp"), "pos")
fmt.Println(wp)
wl := WrapLocationError(errors.New("wl"), "loc")
fmt.Println(wl)
fmt.Println(WrapLocationError(wp, "loc"))
fmt.Println(WrapPositionError(wl, "pos"))
fmt.Println(WrapPositionError(nil, ""))
fmt.Println(WrapLocationError(nil, ""))
Output: wp: [pos:pos] wl: [loc:loc] wp: [pos:pos]: [loc:loc pos:pos] wl: [loc:loc]: [loc:loc pos:pos] <nil> <nil>
func WrapPositionError ¶
Types ¶
type Error ¶
type Error int8
Error validation error +genx:code
const ( ERROR_UNDEFINED Error = iota ERROR__STRING_LENGTH_MODE // invalid string length mode, expect 'byte' or 'rune' ERROR__NOT_MATCH_REGEXP // invalid string not match regexp ERROR__SLICE_PARAM // invalid string parameter ERROR__MAP_PARAM // invalid map parameter ERROR__INPUT_TYPE // invalid input: invalid type ERROR__INPUT_VALUE // invalid input: invalid value ERROR__MISSING_REQUIRED // invalid input: missing required ERROR__UNREGISTERED_RULE // unregistered rule ERROR__DEC_INVALID_INPUT // decoder: invalid input, expecting a pointer value )
type LocationError ¶
type LocationError struct {
// contains filtered or unexported fields
}
func (*LocationError) Error ¶
func (e *LocationError) Error() string
func (*LocationError) Location ¶
func (e *LocationError) Location() string
func (*LocationError) Unwrap ¶
func (e *LocationError) Unwrap() error
type PositionError ¶
type PositionError struct {
// contains filtered or unexported fields
}
func (*PositionError) Error ¶
func (e *PositionError) Error() string
func (*PositionError) Position ¶
func (e *PositionError) Position() string
func (*PositionError) Unwrap ¶
func (e *PositionError) Unwrap() error
type PostValidator ¶
type TagValidator ¶
type TagValidator interface {
ValidationTag() string
}
type UnmarshalDecoder ¶
type WithDefaults ¶
type WithDefaults interface {
Defaults() []byte
}
type WithElemRule ¶
type WithKeyRule ¶
type WithOptional ¶
type WithOptional interface {
Optional() bool
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.