Documentation ¶
Overview ¶
Package zvalid data verification
Index ¶
- Variables
- func Batch(elements ...*ValidEle) error
- func BatchError(rules ...Engine) error
- func JSON(json *zjson.Res, rules map[string]Engine) (err error)
- func Var(target interface{}, source Engine, name ...string) error
- type Engine
- func (v Engine) Bool() (bool, error)
- func (v Engine) CamelCaseToSnakeCase(delimiter ...string) Engine
- func (v Engine) CheckPassword(password string, customError ...string) Engine
- func (v Engine) Customize(fn func(rawValue string, err error) (newValue string, newErr error)) Engine
- func (v Engine) Default(value interface{}) Engine
- func (v Engine) EncryptPassword(cost ...int) Engine
- func (v Engine) EnumFloat64(f []float64, customError ...string) Engine
- func (v Engine) EnumInt(i []int, customError ...string) Engine
- func (v Engine) EnumString(slice []string, customError ...string) Engine
- func (v Engine) Error() error
- func (v Engine) Float64() (float64, error)
- func (v Engine) HasLetter(customError ...string) Engine
- func (v Engine) HasLower(customError ...string) Engine
- func (v Engine) HasNumber(customError ...string) Engine
- func (v Engine) HasPrefix(sub string, customError ...string) Engine
- func (v Engine) HasString(sub string, customError ...string) Engine
- func (v Engine) HasSuffix(sub string, customError ...string) Engine
- func (v Engine) HasSymbol(customError ...string) Engine
- func (v Engine) HasUpper(customError ...string) Engine
- func (v Engine) Int() (int, error)
- func (v Engine) IsBool(customError ...string) Engine
- func (v Engine) IsChinese(customError ...string) Engine
- func (v Engine) IsChineseIDNumber(customError ...string) Engine
- func (v Engine) IsIP(customError ...string) Engine
- func (v Engine) IsInteger(customError ...string) Engine
- func (v Engine) IsJSON(customError ...string) Engine
- func (v Engine) IsLetter(customError ...string) Engine
- func (v Engine) IsLetterOrDigit(customError ...string) Engine
- func (v Engine) IsLower(customError ...string) Engine
- func (v Engine) IsLowerOrDigit(customError ...string) Engine
- func (v Engine) IsMail(customError ...string) Engine
- func (v Engine) IsMobile(customError ...string) Engine
- func (v Engine) IsNumber(customError ...string) Engine
- func (v Engine) IsURL(customError ...string) Engine
- func (v Engine) IsUpper(customError ...string) Engine
- func (v Engine) IsUpperOrDigit(customError ...string) Engine
- func (v Engine) MaxFloat(max float64, customError ...string) Engine
- func (v Engine) MaxInt(max int, customError ...string) Engine
- func (v Engine) MaxLength(max int, customError ...string) Engine
- func (v Engine) MaxUTF8Length(max int, customError ...string) Engine
- func (v Engine) MinFloat(min float64, customError ...string) Engine
- func (v Engine) MinInt(min int, customError ...string) Engine
- func (v Engine) MinLength(min int, customError ...string) Engine
- func (v Engine) MinUTF8Length(min int, customError ...string) Engine
- func (v Engine) Ok() bool
- func (v Engine) Password(customError ...string) Engine
- func (v Engine) Regex(pattern string, customError ...string) Engine
- func (v Engine) RemoveSpace() Engine
- func (v Engine) Replace(old, new string, n int) Engine
- func (v Engine) ReplaceAll(old, new string) Engine
- func (v Engine) Required(customError ...string) Engine
- func (v Engine) Separator(sep string) Engine
- func (v Engine) SetAlias(name string) Engine
- func (v Engine) Silent() Engine
- func (v Engine) SnakeCaseToCamelCase(ucfirst bool, delimiter ...string) Engine
- func (v Engine) Split(sep string) ([]string, error)
- func (v Engine) String() (string, error)
- func (v Engine) StrongPassword(customError ...string) Engine
- func (v Engine) Trim() Engine
- func (v Engine) Value() (value string)
- func (v Engine) Verifi(value string, name ...string) Engine
- func (v Engine) VerifiAny(value interface{}, name ...string) Engine
- func (v Engine) XSSClean() Engine
- type ValidEle
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoValidationValueSet no verification value set ErrNoValidationValueSet = errors.New("未设置验证值") )
Functions ¶
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine valid engine
func (Engine) CamelCaseToSnakeCase ¶
CamelCaseToSnakeCase camelCase To SnakeCase helloWorld/HelloWorld => hello_world
func (Engine) CheckPassword ¶ added in v0.1.33
CheckPassword check encrypt password
func (Engine) Customize ¶
func (v Engine) Customize(fn func(rawValue string, err error) (newValue string, newErr error)) Engine
Customize customize valid
func (Engine) Default ¶ added in v0.0.21
Default if a filtering error occurs, the default value is assigned to the variable
func (Engine) EncryptPassword ¶ added in v0.1.33
EncryptPassword encrypt the password
func (Engine) EnumFloat64 ¶
EnumFloat64 allow only values in []float64
func (Engine) EnumString ¶
EnumString allow only values in []string
func (Engine) IsChineseIDNumber ¶
IsChineseIDNumber mainland china id number
func (Engine) IsLetterOrDigit ¶
IsLetterOrDigit letters or numbers
func (Engine) IsLowerOrDigit ¶
IsLowerOrDigit lowercase letters or numbers
func (Engine) IsUpperOrDigit ¶
IsUpperOrDigit uppercase letters or numbers
func (Engine) MaxUTF8Length ¶
MaxUTF8Length utf8 encoding maximum length
func (Engine) MinUTF8Length ¶
MinUTF8Length utf8 encoding minimum length
func (Engine) ReplaceAll ¶
ReplaceAll replace all text
func (Engine) Required ¶
Required Must have a value (zero values other than "" are allowed). If this rule is not used, when the parameter value is "", data validation does not take effect by default
func (Engine) Silent ¶ added in v0.0.21
Silent an error occurred during filtering, no error is returned
func (Engine) SnakeCaseToCamelCase ¶
SnakeCaseToCamelCase snakeCase To CamelCase: hello_world => helloWorld
func (Engine) StrongPassword ¶
StrongPassword Strong equal strength password (length is 6 ~ 20, must include uppercase and lowercase letters, numbers and special characters)