Documentation
¶
Index ¶
- func Float64(i interface{}) float64
- func Int(i interface{}) int
- func Int64(i interface{}) int64
- func LeDecodeToFloat64(b []byte) float64
- func LeDecodeToInt64(b []byte) int64
- func LeDecodeToUint64(b []byte) uint64
- func LeFillUpSize(b []byte, l int) []byte
- func String(i interface{}) string
- func Uint64(i interface{}) uint64
- type Rule
- func (r *Rule) AddRule(name string, ...) *Rule
- func (r *Rule) Between(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (r *Rule) In(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) InArrayString(content string, values []string) bool
- func (Rule) IsAlphaNum(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) IsChs(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) IsChsAlpha(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) IsChsAlphaNum(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) IsChsDash(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) IsColorHex(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) IsNumber(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (Rule) Length(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (r *Rule) Max(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (r *Rule) Min(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (r *Rule) NotBetween(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- func (r *Rule) NotIn(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
- type Validate
- func (v *Validate) Check(values map[string]interface{}, fail bool) bool
- func (v *Validate) GetError() string
- func (v *Validate) Init() *Validate
- func (v *Validate) Scene(sceneName string) *Validate
- func (v *Validate) SetMsg(msg Validates) *Validate
- func (v *Validate) SetRule(rule Validates) *Validate
- func (v *Validate) SetScene(scene Validates) *Validate
- type Validates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LeDecodeToFloat64 ¶
func LeDecodeToInt64 ¶
func LeDecodeToUint64 ¶
func LeFillUpSize ¶
Types ¶
type Rule ¶
type Rule struct {
RuleMethod map[string]interface{}
}
func (*Rule) AddRule ¶
func (r *Rule) AddRule(name string, fun func(value interface{}, rule string, data map[string]interface{}, arg ...string) bool) *Rule
添加自定义规则
func (*Rule) Between ¶
func (r *Rule) Between(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
验证某个字段的值是否在某个区间(数值类型)
func (Rule) InArrayString ¶
判断是否在数组中
func (Rule) IsAlphaNum ¶
func (Rule) IsAlphaNum(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
判断字段是否由字母和数字组成
func (Rule) IsChsAlpha ¶
func (Rule) IsChsAlpha(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
验证某个字段的值只能是汉字、字母
func (Rule) IsChsAlphaNum ¶
func (Rule) IsChsAlphaNum(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
判断字段是否由汉字、字母和数字组成
func (Rule) IsChsDash ¶
func (Rule) IsChsDash(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
验证某个字段的值只能是汉字、字母、数字和下划线_及破折号-
func (Rule) IsColorHex ¶
func (Rule) IsColorHex(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
判断字段是否为16进制的颜色值
func (Rule) IsNumber ¶
func (Rule) IsNumber(value interface{}, rule string, data map[string]interface{}, arg ...string) bool
判断字段是否为数字
Click to show internal directories.
Click to hide internal directories.