Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrRequired = errors.New("必填") ErrNotBlank = errors.New("不能为空") ErrInvalidLength = errors.New("长度错误") ErrInvalidValue = errors.New("内容错误") ErrInvalidFormat = errors.New("格式错误") ErrInvalidType = errors.New("类型错误") )
View Source
var APP struct { Validator Validator ValidatorAttr struct{ Data AttrData } }
Functions ¶
This section is empty.
Types ¶
type AttrData ¶
type AttrData struct {
// contains filtered or unexported fields
}
func (AttrData) Set ¶
func (AttrData) Set(data any) ValidatorAttributer
type FieldInfo ¶
type FieldInfo struct {
Name string // 字段名
Value any // 实际值
Kind reflect.Kind
IsPtr bool // 是否是指针
IsNil bool // 是否为空指针
Required bool // 是否必填
VRuleTags []string // v-rule tag 的值
VNameTags []string // v-name tag 的值
// contains filtered or unexported fields
}
FieldInfo 保存了字段的相关信息。
type FieldRule ¶
type FieldRule struct{ FieldRuleBase }
type FieldRuleBase ¶
type FieldRuleBase struct{ Required string }
type ValidatorAttributer ¶
type ValidatorAttributer interface{ Register(validator *Validator) }
Click to show internal directories.
Click to hide internal directories.