Documentation ¶
Index ¶
- Constants
- type Regulation
- type Valid
- func (v *Valid) GetInt64(reg *Regulation) (bool, int64, error)
- func (v *Valid) GetIntArray(reg *Regulation) (bool, []int64, error)
- func (v *Valid) GetString(reg *Regulation) (bool, string, error)
- func (v *Valid) GetStringArray(reg *Regulation) (bool, []string, error)
- func (v *Valid) RegData(regs []*Regulation) (map[string]any, error)
Constants ¶
View Source
const ( Int validType = iota String ArrayInt //仅支持在json的内层使用 ArrayString //仅支持在json的内层使用 )
批量检测参数
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Regulation ¶
type Regulation struct { Def any //默认值 Name string //参数名称 Desc string //参数描述 Reg string //正则规则校验 Min int64 //最小值或最小长度 Max int64 //最大值或最大长度 CheckType validType //校验类型 Required bool //是否必填 }
Regulation 校验规则
type Valid ¶
func NewValid ¶
NewValid 创建校验对象 url.Values url参数 或 post 键值对 参数只解析[0] 【数组不做处理】 jsonStr json字符串 当key相同时 json权重高于url.Values数据
func (*Valid) GetIntArray ¶
func (v *Valid) GetIntArray(reg *Regulation) (bool, []int64, error)
func (*Valid) GetStringArray ¶
func (v *Valid) GetStringArray(reg *Regulation) (bool, []string, error)
Click to show internal directories.
Click to hide internal directories.