|
|
@ -300,25 +300,25 @@ func IsISBN10(v *Validate, topStruct reflect.Value, currentStructOrField reflect |
|
|
|
return checksum%11 == 0 |
|
|
|
return checksum%11 == 0 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ExcludesRune is the validation function for validating that the field's value does not contain the rune specified withing the param.
|
|
|
|
// ExcludesRune is the validation function for validating that the field's value does not contain the rune specified within the param.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
func ExcludesRune(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
func ExcludesRune(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
return !ContainsRune(v, topStruct, currentStructOrField, field, fieldType, fieldKind, param) |
|
|
|
return !ContainsRune(v, topStruct, currentStructOrField, field, fieldType, fieldKind, param) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ExcludesAll is the validation function for validating that the field's value does not contain any of the characters specified withing the param.
|
|
|
|
// ExcludesAll is the validation function for validating that the field's value does not contain any of the characters specified within the param.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
func ExcludesAll(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
func ExcludesAll(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
return !ContainsAny(v, topStruct, currentStructOrField, field, fieldType, fieldKind, param) |
|
|
|
return !ContainsAny(v, topStruct, currentStructOrField, field, fieldType, fieldKind, param) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Excludes is the validation function for validating that the field's value does not contain the text specified withing the param.
|
|
|
|
// Excludes is the validation function for validating that the field's value does not contain the text specified within the param.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
func Excludes(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
func Excludes(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
return !Contains(v, topStruct, currentStructOrField, field, fieldType, fieldKind, param) |
|
|
|
return !Contains(v, topStruct, currentStructOrField, field, fieldType, fieldKind, param) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ContainsRune is the validation function for validating that the field's value contains the rune specified withing the param.
|
|
|
|
// ContainsRune is the validation function for validating that the field's value contains the rune specified within the param.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
func ContainsRune(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
func ContainsRune(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
r, _ := utf8.DecodeRuneInString(param) |
|
|
|
r, _ := utf8.DecodeRuneInString(param) |
|
|
@ -326,13 +326,13 @@ func ContainsRune(v *Validate, topStruct reflect.Value, currentStructOrField ref |
|
|
|
return strings.ContainsRune(field.String(), r) |
|
|
|
return strings.ContainsRune(field.String(), r) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ContainsAny is the validation function for validating that the field's value contains any of the characters specified withing the param.
|
|
|
|
// ContainsAny is the validation function for validating that the field's value contains any of the characters specified within the param.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
func ContainsAny(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
func ContainsAny(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
return strings.ContainsAny(field.String(), param) |
|
|
|
return strings.ContainsAny(field.String(), param) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Contains is the validation function for validating that the field's value contains the text specified withing the param.
|
|
|
|
// Contains is the validation function for validating that the field's value contains the text specified within the param.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
// NOTE: This is exposed for use within your own custom functions and not intended to be called directly.
|
|
|
|
func Contains(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
func Contains(v *Validate, topStruct reflect.Value, currentStructOrField reflect.Value, field reflect.Value, fieldType reflect.Type, fieldKind reflect.Kind, param string) bool { |
|
|
|
return strings.Contains(field.String(), param) |
|
|
|
return strings.Contains(field.String(), param) |
|
|
|