Documentation ¶
Index ¶
- Variables
- func AsBool(param string) bool
- func AsFloat(param string) float64
- func AsInt(param string) int64
- func AsUint(param string) uint64
- func CheckField(field reflect.Value, kind reflect.Kind, value string) bool
- func HasValue(fl validator.FieldLevel) bool
- func ParseOneOfParam2(s string) []string
- func RequireCheckFieldValue(fl validator.FieldLevel, param string, value string, defaultNotFoundValue bool) bool
- func ValidateRegex(regexp *regexp.Regexp) func(fl validator.FieldLevel) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ValidateEqualsIf validator.Func = func(fl validator.FieldLevel) bool { field := fl.Field() kind := field.Kind() params := ParseOneOfParam2(fl.Param()) if len(params) < 3 || (len(params)-1)%2 != 0 { panic(fmt.Sprintf("Bad param number for equals_if %s", fl.FieldName())) } for i := 1; i < len(params); i += 2 { if !RequireCheckFieldValue(fl, params[i], params[i+1], false) { return true } } return CheckField(field, kind, params[0]) }
Functions ¶
func HasValue ¶
func HasValue(fl validator.FieldLevel) bool
HasValue is the validation function for validating if the current field's value is not the default static value.
func ParseOneOfParam2 ¶
func RequireCheckFieldValue ¶
func ValidateRegex ¶ added in v2.2.4
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.