Documentation
¶
Index ¶
- Variables
- func AddBindErrors(c *xin.Context, err error, ns string)
- func E(c *xin.Context) xin.H
- func FormatBindErrors(locale string, err error, ns string) error
- func InvalidFieldError(c *xin.Context, ns, field string) error
- func InvalidIDError(c *xin.Context) error
- func InvalidRequestError(c *xin.Context) error
- func NextKeyword(s string) (string, string, bool)
- func TranslateBindErrors(locale string, err error, ns string, tf func(error))
- type DateRangeArg
- type Decimals
- type IDArg
- type Integers
- type Keywords
- type PKArg
- type ParamError
- type Sorter
- type TimeRangeArg
- type Wildcards
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidID = errors.New("invalid id")
View Source
var ErrInvalidUpdates = errors.New("invalid updates")
Functions ¶
func AddBindErrors ¶
AddBindErrors translate bind or validate errors and add it to context
func FormatBindErrors ¶
FormatBindErrors translate bind or validate errors and merge it to a new error
func InvalidIDError ¶
func InvalidRequestError ¶
func TranslateBindErrors ¶
TranslateBindErrors translate bind or validate errors FieldBindErrors:
- {xxx}.error.{field}
- error.param.invalid
ValidationErrors:
- {xxx}.error.{field}.{tag}
- {xxx}.error.param.{tag}
- error.param.{tag}
- error.param.invalid
Types ¶
type DateRangeArg ¶
type DateRangeArg struct {
DateMin time.Time `json:"date_min,omitempty" form:"date_min,strip"`
DateMax time.Time `json:"date_max,omitempty" form:"date_max,strip" validate:"omitempty,gtefield=DateMin"`
}
func (*DateRangeArg) Normalize ¶
func (dra *DateRangeArg) Normalize()
type Decimals ¶
type Decimals struct {
// contains filtered or unexported fields
}
func ParseDecimals ¶
func ParseUdecimals ¶
type IDArg ¶
type IDArg struct {
ID string `json:"id,omitempty" form:"id,strip"`
// contains filtered or unexported fields
}
type Integers ¶
type Integers struct {
// contains filtered or unexported fields
}
func ParseIntegers ¶
func ParseUintegers ¶
type PKArg ¶
type PKArg struct {
ID string `json:"id,omitempty" form:"id,strip"`
// contains filtered or unexported fields
}
type ParamError ¶
type ParamError struct {
Param string `json:"param,omitempty"`
Label string `json:"label,omitempty"`
Message string `json:"message,omitempty"`
}
func (*ParamError) Error ¶
func (pe *ParamError) Error() string
type Sorter ¶ added in v1.2.9
type TimeRangeArg ¶
type Wildcards ¶ added in v1.2.7
type Wildcards []string
func ParseWildcards ¶ added in v1.2.7
func (Wildcards) StartsWith ¶ added in v1.2.8
func (Wildcards) StartsWithAny ¶ added in v1.2.8
Click to show internal directories.
Click to hide internal directories.