Documentation
¶
Index ¶
- Constants
- func All(cases ...bool) bool
- func Any(cases ...bool) bool
- func If[T any](condition bool, trueVal T) T
- func IfElse[T any](condition bool, trueVal, falseVal T) T
- func IfFor[T any](arr []T, condition func(m T) bool, safe ...bool) []T
- func IfLazy[T any](condition bool, trueFn, falseFn func() T) T
- func InArray[T comparable](ele T, arr []T) bool
- func IsAlpha(val string) bool
- func IsAlphaDash(val string) bool
- func IsAlphaNum(val string) bool
- func IsArray(t any) bool
- func IsBool(val any) bool
- func IsCard(val string) bool
- func IsChinese(val string) bool
- func IsChs(val string) bool
- func IsChsAlpha(val string) bool
- func IsChsAlphaNum(val string) bool
- func IsChsDash(val string) bool
- func IsColor(s string) bool
- func IsDate(val string) bool
- func IsDateTime(val string) bool
- func IsEmail(val string) bool
- func IsEmpty(val any) bool
- func IsEnglish(val string) bool
- func IsFile(req *http.Request, maxSize int, allowExt []string, allowMime []string) bool
- func IsImage(req *http.Request, fieldName string, width, heigh, maxSize int, diff float64, ...) error
- func IsInt(val any) bool
- func IsIp(val string) bool
- func IsLower(val string) bool
- func IsMac(val string) bool
- func IsMobile(val string) bool
- func IsNumber(val string) bool
- func IsReal(val any) bool
- func IsTime(val string) bool
- func IsUpper(val string) bool
- func IsUrl(val string) bool
- func IsXdigit(t string) bool
- func IsZip(val string) bool
- func Match[T any](cases ...any) T
- func ParseInt(val string) (res int)
- func ToDouble(v any) (float64, bool)
- func ToFloat(v any) float32
- func ToInt(v any) (int, bool)
- func ToInt64(v any) int64
- func ToUint(v any) (uint, bool)
- func ToUint64(v any) (uint64, bool)
- type MapStr
- type Validate
- func (v *Validate) Check(data []Value, group ...string) error
- func (v *Validate) Lang(l i18n.Lang) *Validate
- func (v *Validate) Message(m MapStr) *Validate
- func (v *Validate) Rule(r MapStr) *Validate
- func (v *Validate) Scene(name string) *Validate
- func (v *Validate) SetMessage(cases ...string) *Validate
- func (v *Validate) SetRule(name string, rule string) *Validate
- type Validater
- type Value
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type MapStr ¶
func (MapStr) GetEqContent ¶
GetEqContent 获取map中的值包含eq=后面的字段,比如 eq=password,得到password
type Validate ¶
type Validate struct {
Rules MapStr
Messages MapStr
Groups map[string]MapStr
Scenes map[string][]string
CurrentScene string
// contains filtered or unexported fields
}
func (*Validate) SetMessage ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.