Documentation ¶
Index ¶
- type Checker
- type Context
- func (ctx *Context) Assert(condition bool, errMsg string) *Context
- func (ctx *Context) AssertError(err error) *Context
- func (ctx *Context) Eq(expect any) *Context
- func (ctx *Context) Error() error
- func (ctx *Context) Ge(expect any) *Context
- func (ctx *Context) Gt(expect any) *Context
- func (ctx *Context) In(expect ...any) *Context
- func (ctx *Context) IsEmail() *Context
- func (ctx *Context) IsNumeric() *Context
- func (ctx *Context) IsURL() *Context
- func (ctx *Context) Le(expect any) *Context
- func (ctx *Context) Length(min, max int) *Context
- func (ctx *Context) Lt(expect any) *Context
- func (ctx *Context) Match(expect string) *Context
- func (ctx *Context) Neq(expect any) *Context
- func (ctx *Context) NotBlank() *Context
- func (ctx *Context) NotEmpty() *Context
- func (ctx *Context) NotIn(expect ...any) *Context
- func (ctx *Context) NotNil() *Context
- func (ctx *Context) Range(min, max float64) *Context
- func (ctx *Context) Size(min, max int) *Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
type Checker struct {
SolveError func(err error)
}
func (*Checker) AssertError ¶ added in v1.3.2
type Context ¶ added in v1.3.1
type Context struct {
// contains filtered or unexported fields
}
func (*Context) AssertError ¶ added in v1.3.2
func (*Context) Eq ¶ added in v1.3.1
check whether value == expect
Only valid for int/int8/.../uint/uint8/.../float32/float64/string and their pointer.
It will also be invalid if the types do not match. For example:
If value is int and expect is string, it is invalid; If value is int and expect is float32, it is valid.
func (*Context) Ge ¶ added in v1.3.1
Check whether value >= expect. The type handling mechanism is the same as `Eq`.
func (*Context) Gt ¶ added in v1.3.1
Check whether value > expect. The type handling mechanism is the same as `Eq`.
func (*Context) In ¶ added in v1.3.1
Check whether value is in expect.
When compare value with items in expect, it is only valid for int/int8/.../uint/uint8/.../float32/float64/string and their pointer.
func (*Context) Le ¶ added in v1.3.1
Check whether value <= expect. The type handling mechanism is the same as `Eq`.
func (*Context) Lt ¶ added in v1.3.1
Check whether value < expect. The type handling mechanism is the same as `Eq`.
func (*Context) Match ¶ added in v1.3.1
Check whether value matches expect (expect is a regexp)
Only valid when value is string/*string
func (*Context) Neq ¶ added in v1.3.1
Check whether value != expect. The type handling mechanism is the same as `Eq`.
func (*Context) NotIn ¶ added in v1.3.1
Check whether value is not in expect. The type handling mechanism is the same as `In`.