@ -56,7 +56,7 @@ var (
isdefault : { } ,
isdefault : { } ,
}
}
// BakedInAliasValidator s is a default mapping of a single validation tag that
// bakedInAliase s is a default mapping of a single validation tag that
// defines a common or complex set of validation(s) to simplify
// defines a common or complex set of validation(s) to simplify
// adding validation to structs.
// adding validation to structs.
bakedInAliases = map [ string ] string {
bakedInAliases = map [ string ] string {
@ -64,7 +64,7 @@ var (
"country_code" : "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric" ,
"country_code" : "iso3166_1_alpha2|iso3166_1_alpha3|iso3166_1_alpha_numeric" ,
}
}
// B akedInValidators is the default map of ValidationFunc
// b akedInValidators is the default map of ValidationFunc
// you can add, remove or even replace items to suite your needs,
// you can add, remove or even replace items to suite your needs,
// or even disregard and use your own map if so desired.
// or even disregard and use your own map if so desired.
bakedInValidators = map [ string ] Func {
bakedInValidators = map [ string ] Func {
@ -190,7 +190,7 @@ var (
"iso3166_1_alpha2" : isIso3166Alpha2 ,
"iso3166_1_alpha2" : isIso3166Alpha2 ,
"iso3166_1_alpha3" : isIso3166Alpha3 ,
"iso3166_1_alpha3" : isIso3166Alpha3 ,
"iso3166_1_alpha_numeric" : isIso3166AlphaNumeric ,
"iso3166_1_alpha_numeric" : isIso3166AlphaNumeric ,
"iso3166_2" : isIso31662 ,
"iso3166_2" : isIso31662 ,
"bcp47_language_tag" : isBCP47LanguageTag ,
"bcp47_language_tag" : isBCP47LanguageTag ,
"postcode_iso3166_alpha2" : isPostcodeByIso3166Alpha2 ,
"postcode_iso3166_alpha2" : isPostcodeByIso3166Alpha2 ,
"postcode_iso3166_alpha2_field" : isPostcodeByIso3166Alpha2Field ,
"postcode_iso3166_alpha2_field" : isPostcodeByIso3166Alpha2Field ,
@ -303,7 +303,7 @@ func isUnique(fl FieldLevel) bool {
}
}
}
}
// I sMAC is the validation function for validating if the field's value is a valid MAC address.
// i sMAC is the validation function for validating if the field's value is a valid MAC address.
func isMAC ( fl FieldLevel ) bool {
func isMAC ( fl FieldLevel ) bool {
_ , err := net . ParseMAC ( fl . Field ( ) . String ( ) )
_ , err := net . ParseMAC ( fl . Field ( ) . String ( ) )
@ -311,7 +311,7 @@ func isMAC(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sCIDRv4 is the validation function for validating if the field's value is a valid v4 CIDR address.
// i sCIDRv4 is the validation function for validating if the field's value is a valid v4 CIDR address.
func isCIDRv4 ( fl FieldLevel ) bool {
func isCIDRv4 ( fl FieldLevel ) bool {
ip , _ , err := net . ParseCIDR ( fl . Field ( ) . String ( ) )
ip , _ , err := net . ParseCIDR ( fl . Field ( ) . String ( ) )
@ -319,7 +319,7 @@ func isCIDRv4(fl FieldLevel) bool {
return err == nil && ip . To4 ( ) != nil
return err == nil && ip . To4 ( ) != nil
}
}
// I sCIDRv6 is the validation function for validating if the field's value is a valid v6 CIDR address.
// i sCIDRv6 is the validation function for validating if the field's value is a valid v6 CIDR address.
func isCIDRv6 ( fl FieldLevel ) bool {
func isCIDRv6 ( fl FieldLevel ) bool {
ip , _ , err := net . ParseCIDR ( fl . Field ( ) . String ( ) )
ip , _ , err := net . ParseCIDR ( fl . Field ( ) . String ( ) )
@ -327,7 +327,7 @@ func isCIDRv6(fl FieldLevel) bool {
return err == nil && ip . To4 ( ) == nil
return err == nil && ip . To4 ( ) == nil
}
}
// I sCIDR is the validation function for validating if the field's value is a valid v4 or v6 CIDR address.
// i sCIDR is the validation function for validating if the field's value is a valid v4 or v6 CIDR address.
func isCIDR ( fl FieldLevel ) bool {
func isCIDR ( fl FieldLevel ) bool {
_ , _ , err := net . ParseCIDR ( fl . Field ( ) . String ( ) )
_ , _ , err := net . ParseCIDR ( fl . Field ( ) . String ( ) )
@ -335,7 +335,7 @@ func isCIDR(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sIPv4 is the validation function for validating if a value is a valid v4 IP address.
// i sIPv4 is the validation function for validating if a value is a valid v4 IP address.
func isIPv4 ( fl FieldLevel ) bool {
func isIPv4 ( fl FieldLevel ) bool {
ip := net . ParseIP ( fl . Field ( ) . String ( ) )
ip := net . ParseIP ( fl . Field ( ) . String ( ) )
@ -343,7 +343,7 @@ func isIPv4(fl FieldLevel) bool {
return ip != nil && ip . To4 ( ) != nil
return ip != nil && ip . To4 ( ) != nil
}
}
// I sIPv6 is the validation function for validating if the field's value is a valid v6 IP address.
// i sIPv6 is the validation function for validating if the field's value is a valid v6 IP address.
func isIPv6 ( fl FieldLevel ) bool {
func isIPv6 ( fl FieldLevel ) bool {
ip := net . ParseIP ( fl . Field ( ) . String ( ) )
ip := net . ParseIP ( fl . Field ( ) . String ( ) )
@ -351,7 +351,7 @@ func isIPv6(fl FieldLevel) bool {
return ip != nil && ip . To4 ( ) == nil
return ip != nil && ip . To4 ( ) == nil
}
}
// I sIP is the validation function for validating if the field's value is a valid v4 or v6 IP address.
// i sIP is the validation function for validating if the field's value is a valid v4 or v6 IP address.
func isIP ( fl FieldLevel ) bool {
func isIP ( fl FieldLevel ) bool {
ip := net . ParseIP ( fl . Field ( ) . String ( ) )
ip := net . ParseIP ( fl . Field ( ) . String ( ) )
@ -359,7 +359,7 @@ func isIP(fl FieldLevel) bool {
return ip != nil
return ip != nil
}
}
// I sSSN is the validation function for validating if the field's value is a valid SSN.
// i sSSN is the validation function for validating if the field's value is a valid SSN.
func isSSN ( fl FieldLevel ) bool {
func isSSN ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -371,7 +371,7 @@ func isSSN(fl FieldLevel) bool {
return sSNRegex . MatchString ( field . String ( ) )
return sSNRegex . MatchString ( field . String ( ) )
}
}
// I sLongitude is the validation function for validating if the field's value is a valid longitude coordinate.
// i sLongitude is the validation function for validating if the field's value is a valid longitude coordinate.
func isLongitude ( fl FieldLevel ) bool {
func isLongitude ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -394,7 +394,7 @@ func isLongitude(fl FieldLevel) bool {
return longitudeRegex . MatchString ( v )
return longitudeRegex . MatchString ( v )
}
}
// I sLatitude is the validation function for validating if the field's value is a valid latitude coordinate.
// i sLatitude is the validation function for validating if the field's value is a valid latitude coordinate.
func isLatitude ( fl FieldLevel ) bool {
func isLatitude ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -417,7 +417,7 @@ func isLatitude(fl FieldLevel) bool {
return latitudeRegex . MatchString ( v )
return latitudeRegex . MatchString ( v )
}
}
// I sDataURI is the validation function for validating if the field's value is a valid data URI.
// i sDataURI is the validation function for validating if the field's value is a valid data URI.
func isDataURI ( fl FieldLevel ) bool {
func isDataURI ( fl FieldLevel ) bool {
uri := strings . SplitN ( fl . Field ( ) . String ( ) , "," , 2 )
uri := strings . SplitN ( fl . Field ( ) . String ( ) , "," , 2 )
@ -433,7 +433,7 @@ func isDataURI(fl FieldLevel) bool {
return base64Regex . MatchString ( uri [ 1 ] )
return base64Regex . MatchString ( uri [ 1 ] )
}
}
// H asMultiByteCharacter is the validation function for validating if the field's value has a multi byte character.
// h asMultiByteCharacter is the validation function for validating if the field's value has a multi byte character.
func hasMultiByteCharacter ( fl FieldLevel ) bool {
func hasMultiByteCharacter ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -445,62 +445,62 @@ func hasMultiByteCharacter(fl FieldLevel) bool {
return multibyteRegex . MatchString ( field . String ( ) )
return multibyteRegex . MatchString ( field . String ( ) )
}
}
// I sPrintableASCII is the validation function for validating if the field's value is a valid printable ASCII character.
// i sPrintableASCII is the validation function for validating if the field's value is a valid printable ASCII character.
func isPrintableASCII ( fl FieldLevel ) bool {
func isPrintableASCII ( fl FieldLevel ) bool {
return printableASCIIRegex . MatchString ( fl . Field ( ) . String ( ) )
return printableASCIIRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sASCII is the validation function for validating if the field's value is a valid ASCII character.
// i sASCII is the validation function for validating if the field's value is a valid ASCII character.
func isASCII ( fl FieldLevel ) bool {
func isASCII ( fl FieldLevel ) bool {
return aSCIIRegex . MatchString ( fl . Field ( ) . String ( ) )
return aSCIIRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUID5 is the validation function for validating if the field's value is a valid v5 UUID.
// i sUUID5 is the validation function for validating if the field's value is a valid v5 UUID.
func isUUID5 ( fl FieldLevel ) bool {
func isUUID5 ( fl FieldLevel ) bool {
return uUID5Regex . MatchString ( fl . Field ( ) . String ( ) )
return uUID5Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUID4 is the validation function for validating if the field's value is a valid v4 UUID.
// i sUUID4 is the validation function for validating if the field's value is a valid v4 UUID.
func isUUID4 ( fl FieldLevel ) bool {
func isUUID4 ( fl FieldLevel ) bool {
return uUID4Regex . MatchString ( fl . Field ( ) . String ( ) )
return uUID4Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUID3 is the validation function for validating if the field's value is a valid v3 UUID.
// i sUUID3 is the validation function for validating if the field's value is a valid v3 UUID.
func isUUID3 ( fl FieldLevel ) bool {
func isUUID3 ( fl FieldLevel ) bool {
return uUID3Regex . MatchString ( fl . Field ( ) . String ( ) )
return uUID3Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUID is the validation function for validating if the field's value is a valid UUID of any version.
// i sUUID is the validation function for validating if the field's value is a valid UUID of any version.
func isUUID ( fl FieldLevel ) bool {
func isUUID ( fl FieldLevel ) bool {
return uUIDRegex . MatchString ( fl . Field ( ) . String ( ) )
return uUIDRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUID5RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v5 UUID.
// i sUUID5RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v5 UUID.
func isUUID5RFC4122 ( fl FieldLevel ) bool {
func isUUID5RFC4122 ( fl FieldLevel ) bool {
return uUID5RFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
return uUID5RFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUID4RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v4 UUID.
// i sUUID4RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v4 UUID.
func isUUID4RFC4122 ( fl FieldLevel ) bool {
func isUUID4RFC4122 ( fl FieldLevel ) bool {
return uUID4RFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
return uUID4RFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUID3RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v3 UUID.
// i sUUID3RFC4122 is the validation function for validating if the field's value is a valid RFC4122 v3 UUID.
func isUUID3RFC4122 ( fl FieldLevel ) bool {
func isUUID3RFC4122 ( fl FieldLevel ) bool {
return uUID3RFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
return uUID3RFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sUUIDRFC4122 is the validation function for validating if the field's value is a valid RFC4122 UUID of any version.
// i sUUIDRFC4122 is the validation function for validating if the field's value is a valid RFC4122 UUID of any version.
func isUUIDRFC4122 ( fl FieldLevel ) bool {
func isUUIDRFC4122 ( fl FieldLevel ) bool {
return uUIDRFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
return uUIDRFC4122Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN.
// i sISBN is the validation function for validating if the field's value is a valid v10 or v13 ISBN.
func isISBN ( fl FieldLevel ) bool {
func isISBN ( fl FieldLevel ) bool {
return isISBN10 ( fl ) || isISBN13 ( fl )
return isISBN10 ( fl ) || isISBN13 ( fl )
}
}
// I sISBN13 is the validation function for validating if the field's value is a valid v13 ISBN.
// i sISBN13 is the validation function for validating if the field's value is a valid v13 ISBN.
func isISBN13 ( fl FieldLevel ) bool {
func isISBN13 ( fl FieldLevel ) bool {
s := strings . Replace ( strings . Replace ( fl . Field ( ) . String ( ) , "-" , "" , 4 ) , " " , "" , 4 )
s := strings . Replace ( strings . Replace ( fl . Field ( ) . String ( ) , "-" , "" , 4 ) , " " , "" , 4 )
@ -521,7 +521,7 @@ func isISBN13(fl FieldLevel) bool {
return ( int32 ( s [ 12 ] - '0' ) ) - ( ( 10 - ( checksum % 10 ) ) % 10 ) == 0
return ( int32 ( s [ 12 ] - '0' ) ) - ( ( 10 - ( checksum % 10 ) ) % 10 ) == 0
}
}
// I sISBN10 is the validation function for validating if the field's value is a valid v10 ISBN.
// i sISBN10 is the validation function for validating if the field's value is a valid v10 ISBN.
func isISBN10 ( fl FieldLevel ) bool {
func isISBN10 ( fl FieldLevel ) bool {
s := strings . Replace ( strings . Replace ( fl . Field ( ) . String ( ) , "-" , "" , 3 ) , " " , "" , 3 )
s := strings . Replace ( strings . Replace ( fl . Field ( ) . String ( ) , "-" , "" , 3 ) , " " , "" , 3 )
@ -546,7 +546,7 @@ func isISBN10(fl FieldLevel) bool {
return checksum % 11 == 0
return checksum % 11 == 0
}
}
// I sEthereumAddress is the validation function for validating if the field's value is a valid Ethereum address.
// i sEthereumAddress is the validation function for validating if the field's value is a valid Ethereum address.
func isEthereumAddress ( fl FieldLevel ) bool {
func isEthereumAddress ( fl FieldLevel ) bool {
address := fl . Field ( ) . String ( )
address := fl . Field ( ) . String ( )
@ -577,7 +577,7 @@ func isEthereumAddress(fl FieldLevel) bool {
return true
return true
}
}
// I sBitcoinAddress is the validation function for validating if the field's value is a valid btc address
// i sBitcoinAddress is the validation function for validating if the field's value is a valid btc address
func isBitcoinAddress ( fl FieldLevel ) bool {
func isBitcoinAddress ( fl FieldLevel ) bool {
address := fl . Field ( ) . String ( )
address := fl . Field ( ) . String ( )
@ -614,7 +614,7 @@ func isBitcoinAddress(fl FieldLevel) bool {
return validchecksum == computedchecksum
return validchecksum == computedchecksum
}
}
// I sBitcoinBech32Address is the validation function for validating if the field's value is a valid bech32 btc address
// i sBitcoinBech32Address is the validation function for validating if the field's value is a valid bech32 btc address
func isBitcoinBech32Address ( fl FieldLevel ) bool {
func isBitcoinBech32Address ( fl FieldLevel ) bool {
address := fl . Field ( ) . String ( )
address := fl . Field ( ) . String ( )
@ -694,22 +694,22 @@ func isBitcoinBech32Address(fl FieldLevel) bool {
return true
return true
}
}
// E xcludesRune is the validation function for validating that the field's value does not contain the rune specified within the param.
// e xcludesRune is the validation function for validating that the field's value does not contain the rune specified within the param.
func excludesRune ( fl FieldLevel ) bool {
func excludesRune ( fl FieldLevel ) bool {
return ! containsRune ( fl )
return ! containsRune ( fl )
}
}
// E xcludesAll is the validation function for validating that the field's value does not contain any of the characters specified within the param.
// e xcludesAll is the validation function for validating that the field's value does not contain any of the characters specified within the param.
func excludesAll ( fl FieldLevel ) bool {
func excludesAll ( fl FieldLevel ) bool {
return ! containsAny ( fl )
return ! containsAny ( fl )
}
}
// E xcludes is the validation function for validating that the field's value does not contain the text specified within the param.
// e xcludes is the validation function for validating that the field's value does not contain the text specified within the param.
func excludes ( fl FieldLevel ) bool {
func excludes ( fl FieldLevel ) bool {
return ! contains ( fl )
return ! contains ( fl )
}
}
// C ontainsRune is the validation function for validating that the field's value contains the rune specified within the param.
// c ontainsRune is the validation function for validating that the field's value contains the rune specified within the param.
func containsRune ( fl FieldLevel ) bool {
func containsRune ( fl FieldLevel ) bool {
r , _ := utf8 . DecodeRuneInString ( fl . Param ( ) )
r , _ := utf8 . DecodeRuneInString ( fl . Param ( ) )
@ -717,37 +717,37 @@ func containsRune(fl FieldLevel) bool {
return strings . ContainsRune ( fl . Field ( ) . String ( ) , r )
return strings . ContainsRune ( fl . Field ( ) . String ( ) , r )
}
}
// C ontainsAny is the validation function for validating that the field's value contains any of the characters specified within the param.
// c ontainsAny is the validation function for validating that the field's value contains any of the characters specified within the param.
func containsAny ( fl FieldLevel ) bool {
func containsAny ( fl FieldLevel ) bool {
return strings . ContainsAny ( fl . Field ( ) . String ( ) , fl . Param ( ) )
return strings . ContainsAny ( fl . Field ( ) . String ( ) , fl . Param ( ) )
}
}
// C ontains is the validation function for validating that the field's value contains the text specified within the param.
// c ontains is the validation function for validating that the field's value contains the text specified within the param.
func contains ( fl FieldLevel ) bool {
func contains ( fl FieldLevel ) bool {
return strings . Contains ( fl . Field ( ) . String ( ) , fl . Param ( ) )
return strings . Contains ( fl . Field ( ) . String ( ) , fl . Param ( ) )
}
}
// S tartsWith is the validation function for validating that the field's value starts with the text specified within the param.
// s tartsWith is the validation function for validating that the field's value starts with the text specified within the param.
func startsWith ( fl FieldLevel ) bool {
func startsWith ( fl FieldLevel ) bool {
return strings . HasPrefix ( fl . Field ( ) . String ( ) , fl . Param ( ) )
return strings . HasPrefix ( fl . Field ( ) . String ( ) , fl . Param ( ) )
}
}
// E ndsWith is the validation function for validating that the field's value ends with the text specified within the param.
// e ndsWith is the validation function for validating that the field's value ends with the text specified within the param.
func endsWith ( fl FieldLevel ) bool {
func endsWith ( fl FieldLevel ) bool {
return strings . HasSuffix ( fl . Field ( ) . String ( ) , fl . Param ( ) )
return strings . HasSuffix ( fl . Field ( ) . String ( ) , fl . Param ( ) )
}
}
// S tartsNotWith is the validation function for validating that the field's value does not start with the text specified within the param.
// s tartsNotWith is the validation function for validating that the field's value does not start with the text specified within the param.
func startsNotWith ( fl FieldLevel ) bool {
func startsNotWith ( fl FieldLevel ) bool {
return ! startsWith ( fl )
return ! startsWith ( fl )
}
}
// E ndsNotWith is the validation function for validating that the field's value does not end with the text specified within the param.
// e ndsNotWith is the validation function for validating that the field's value does not end with the text specified within the param.
func endsNotWith ( fl FieldLevel ) bool {
func endsNotWith ( fl FieldLevel ) bool {
return ! endsWith ( fl )
return ! endsWith ( fl )
}
}
// F ieldContains is the validation function for validating if the current field's value contains the field specified by the param's value.
// f ieldContains is the validation function for validating if the current field's value contains the field specified by the param's value.
func fieldContains ( fl FieldLevel ) bool {
func fieldContains ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -760,7 +760,7 @@ func fieldContains(fl FieldLevel) bool {
return strings . Contains ( field . String ( ) , currentField . String ( ) )
return strings . Contains ( field . String ( ) , currentField . String ( ) )
}
}
// F ieldExcludes is the validation function for validating if the current field's value excludes the field specified by the param's value.
// f ieldExcludes is the validation function for validating if the current field's value excludes the field specified by the param's value.
func fieldExcludes ( fl FieldLevel ) bool {
func fieldExcludes ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -772,7 +772,7 @@ func fieldExcludes(fl FieldLevel) bool {
return ! strings . Contains ( field . String ( ) , currentField . String ( ) )
return ! strings . Contains ( field . String ( ) , currentField . String ( ) )
}
}
// I sNeField is the validation function for validating if the current field's value is not equal to the field specified by the param's value.
// i sNeField is the validation function for validating if the current field's value is not equal to the field specified by the param's value.
func isNeField ( fl FieldLevel ) bool {
func isNeField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -824,12 +824,12 @@ func isNeField(fl FieldLevel) bool {
return field . String ( ) != currentField . String ( )
return field . String ( ) != currentField . String ( )
}
}
// I sNe is the validation function for validating that the field's value does not equal the provided param value.
// i sNe is the validation function for validating that the field's value does not equal the provided param value.
func isNe ( fl FieldLevel ) bool {
func isNe ( fl FieldLevel ) bool {
return ! isEq ( fl )
return ! isEq ( fl )
}
}
// I sLteCrossStructField is the validation function for validating if the current field's value is less than or equal to the field, within a separate struct, specified by the param's value.
// i sLteCrossStructField is the validation function for validating if the current field's value is less than or equal to the field, within a separate struct, specified by the param's value.
func isLteCrossStructField ( fl FieldLevel ) bool {
func isLteCrossStructField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -876,7 +876,7 @@ func isLteCrossStructField(fl FieldLevel) bool {
return field . String ( ) <= topField . String ( )
return field . String ( ) <= topField . String ( )
}
}
// I sLtCrossStructField is the validation function for validating if the current field's value is less than the field, within a separate struct, specified by the param's value.
// i sLtCrossStructField is the validation function for validating if the current field's value is less than the field, within a separate struct, specified by the param's value.
// 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 isLtCrossStructField ( fl FieldLevel ) bool {
func isLtCrossStructField ( fl FieldLevel ) bool {
@ -924,7 +924,7 @@ func isLtCrossStructField(fl FieldLevel) bool {
return field . String ( ) < topField . String ( )
return field . String ( ) < topField . String ( )
}
}
// I sGteCrossStructField is the validation function for validating if the current field's value is greater than or equal to the field, within a separate struct, specified by the param's value.
// i sGteCrossStructField is the validation function for validating if the current field's value is greater than or equal to the field, within a separate struct, specified by the param's value.
func isGteCrossStructField ( fl FieldLevel ) bool {
func isGteCrossStructField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -971,7 +971,7 @@ func isGteCrossStructField(fl FieldLevel) bool {
return field . String ( ) >= topField . String ( )
return field . String ( ) >= topField . String ( )
}
}
// I sGtCrossStructField is the validation function for validating if the current field's value is greater than the field, within a separate struct, specified by the param's value.
// i sGtCrossStructField is the validation function for validating if the current field's value is greater than the field, within a separate struct, specified by the param's value.
func isGtCrossStructField ( fl FieldLevel ) bool {
func isGtCrossStructField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1018,7 +1018,7 @@ func isGtCrossStructField(fl FieldLevel) bool {
return field . String ( ) > topField . String ( )
return field . String ( ) > topField . String ( )
}
}
// I sNeCrossStructField is the validation function for validating that the current field's value is not equal to the field, within a separate struct, specified by the param's value.
// i sNeCrossStructField is the validation function for validating that the current field's value is not equal to the field, within a separate struct, specified by the param's value.
func isNeCrossStructField ( fl FieldLevel ) bool {
func isNeCrossStructField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1068,7 +1068,7 @@ func isNeCrossStructField(fl FieldLevel) bool {
return topField . String ( ) != field . String ( )
return topField . String ( ) != field . String ( )
}
}
// I sEqCrossStructField is the validation function for validating that the current field's value is equal to the field, within a separate struct, specified by the param's value.
// i sEqCrossStructField is the validation function for validating that the current field's value is equal to the field, within a separate struct, specified by the param's value.
func isEqCrossStructField ( fl FieldLevel ) bool {
func isEqCrossStructField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1118,7 +1118,7 @@ func isEqCrossStructField(fl FieldLevel) bool {
return topField . String ( ) == field . String ( )
return topField . String ( ) == field . String ( )
}
}
// I sEqField is the validation function for validating if the current field's value is equal to the field specified by the param's value.
// i sEqField is the validation function for validating if the current field's value is equal to the field specified by the param's value.
func isEqField ( fl FieldLevel ) bool {
func isEqField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1169,7 +1169,7 @@ func isEqField(fl FieldLevel) bool {
return field . String ( ) == currentField . String ( )
return field . String ( ) == currentField . String ( )
}
}
// I sEq is the validation function for validating if the current field's value is equal to the param's value.
// i sEq is the validation function for validating if the current field's value is equal to the param's value.
func isEq ( fl FieldLevel ) bool {
func isEq ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1250,17 +1250,17 @@ func isPostcodeByIso3166Alpha2Field(fl FieldLevel) bool {
return reg . MatchString ( field . String ( ) )
return reg . MatchString ( field . String ( ) )
}
}
// I sBase64 is the validation function for validating if the current field's value is a valid base 64.
// i sBase64 is the validation function for validating if the current field's value is a valid base 64.
func isBase64 ( fl FieldLevel ) bool {
func isBase64 ( fl FieldLevel ) bool {
return base64Regex . MatchString ( fl . Field ( ) . String ( ) )
return base64Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sBase64URL is the validation function for validating if the current field's value is a valid base64 URL safe string.
// i sBase64URL is the validation function for validating if the current field's value is a valid base64 URL safe string.
func isBase64URL ( fl FieldLevel ) bool {
func isBase64URL ( fl FieldLevel ) bool {
return base64URLRegex . MatchString ( fl . Field ( ) . String ( ) )
return base64URLRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sURI is the validation function for validating if the current field's value is a valid URI.
// i sURI is the validation function for validating if the current field's value is a valid URI.
func isURI ( fl FieldLevel ) bool {
func isURI ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1289,7 +1289,7 @@ func isURI(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// I sURL is the validation function for validating if the current field's value is a valid URL.
// i sURL is the validation function for validating if the current field's value is a valid URL.
func isURL ( fl FieldLevel ) bool {
func isURL ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1341,7 +1341,7 @@ func isUrnRFC2141(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// I sFile is the validation function for validating if the current field's value is a valid file path.
// i sFile is the validation function for validating if the current field's value is a valid file path.
func isFile ( fl FieldLevel ) bool {
func isFile ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1358,47 +1358,47 @@ func isFile(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// I sE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number.
// i sE164 is the validation function for validating if the current field's value is a valid e.164 formatted phone number.
func isE164 ( fl FieldLevel ) bool {
func isE164 ( fl FieldLevel ) bool {
return e164Regex . MatchString ( fl . Field ( ) . String ( ) )
return e164Regex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sEmail is the validation function for validating if the current field's value is a valid email address.
// i sEmail is the validation function for validating if the current field's value is a valid email address.
func isEmail ( fl FieldLevel ) bool {
func isEmail ( fl FieldLevel ) bool {
return emailRegex . MatchString ( fl . Field ( ) . String ( ) )
return emailRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sHSLA is the validation function for validating if the current field's value is a valid HSLA color.
// i sHSLA is the validation function for validating if the current field's value is a valid HSLA color.
func isHSLA ( fl FieldLevel ) bool {
func isHSLA ( fl FieldLevel ) bool {
return hslaRegex . MatchString ( fl . Field ( ) . String ( ) )
return hslaRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sHSL is the validation function for validating if the current field's value is a valid HSL color.
// i sHSL is the validation function for validating if the current field's value is a valid HSL color.
func isHSL ( fl FieldLevel ) bool {
func isHSL ( fl FieldLevel ) bool {
return hslRegex . MatchString ( fl . Field ( ) . String ( ) )
return hslRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sRGBA is the validation function for validating if the current field's value is a valid RGBA color.
// i sRGBA is the validation function for validating if the current field's value is a valid RGBA color.
func isRGBA ( fl FieldLevel ) bool {
func isRGBA ( fl FieldLevel ) bool {
return rgbaRegex . MatchString ( fl . Field ( ) . String ( ) )
return rgbaRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sRGB is the validation function for validating if the current field's value is a valid RGB color.
// i sRGB is the validation function for validating if the current field's value is a valid RGB color.
func isRGB ( fl FieldLevel ) bool {
func isRGB ( fl FieldLevel ) bool {
return rgbRegex . MatchString ( fl . Field ( ) . String ( ) )
return rgbRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sHEXColor is the validation function for validating if the current field's value is a valid HEX color.
// i sHEXColor is the validation function for validating if the current field's value is a valid HEX color.
func isHEXColor ( fl FieldLevel ) bool {
func isHEXColor ( fl FieldLevel ) bool {
return hexColorRegex . MatchString ( fl . Field ( ) . String ( ) )
return hexColorRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sHexadecimal is the validation function for validating if the current field's value is a valid hexadecimal.
// i sHexadecimal is the validation function for validating if the current field's value is a valid hexadecimal.
func isHexadecimal ( fl FieldLevel ) bool {
func isHexadecimal ( fl FieldLevel ) bool {
return hexadecimalRegex . MatchString ( fl . Field ( ) . String ( ) )
return hexadecimalRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sNumber is the validation function for validating if the current field's value is a valid number.
// i sNumber is the validation function for validating if the current field's value is a valid number.
func isNumber ( fl FieldLevel ) bool {
func isNumber ( fl FieldLevel ) bool {
switch fl . Field ( ) . Kind ( ) {
switch fl . Field ( ) . Kind ( ) {
case reflect . Int , reflect . Int8 , reflect . Int16 , reflect . Int32 , reflect . Int64 , reflect . Uint , reflect . Uint8 , reflect . Uint16 , reflect . Uint32 , reflect . Uint64 , reflect . Uintptr , reflect . Float32 , reflect . Float64 :
case reflect . Int , reflect . Int8 , reflect . Int16 , reflect . Int32 , reflect . Int64 , reflect . Uint , reflect . Uint8 , reflect . Uint16 , reflect . Uint32 , reflect . Uint64 , reflect . Uintptr , reflect . Float32 , reflect . Float64 :
@ -1408,7 +1408,7 @@ func isNumber(fl FieldLevel) bool {
}
}
}
}
// I sNumeric is the validation function for validating if the current field's value is a valid numeric value.
// i sNumeric is the validation function for validating if the current field's value is a valid numeric value.
func isNumeric ( fl FieldLevel ) bool {
func isNumeric ( fl FieldLevel ) bool {
switch fl . Field ( ) . Kind ( ) {
switch fl . Field ( ) . Kind ( ) {
case reflect . Int , reflect . Int8 , reflect . Int16 , reflect . Int32 , reflect . Int64 , reflect . Uint , reflect . Uint8 , reflect . Uint16 , reflect . Uint32 , reflect . Uint64 , reflect . Uintptr , reflect . Float32 , reflect . Float64 :
case reflect . Int , reflect . Int8 , reflect . Int16 , reflect . Int32 , reflect . Int64 , reflect . Uint , reflect . Uint8 , reflect . Uint16 , reflect . Uint32 , reflect . Uint64 , reflect . Uintptr , reflect . Float32 , reflect . Float64 :
@ -1418,22 +1418,22 @@ func isNumeric(fl FieldLevel) bool {
}
}
}
}
// I sAlphanum is the validation function for validating if the current field's value is a valid alphanumeric value.
// i sAlphanum is the validation function for validating if the current field's value is a valid alphanumeric value.
func isAlphanum ( fl FieldLevel ) bool {
func isAlphanum ( fl FieldLevel ) bool {
return alphaNumericRegex . MatchString ( fl . Field ( ) . String ( ) )
return alphaNumericRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sAlpha is the validation function for validating if the current field's value is a valid alpha value.
// i sAlpha is the validation function for validating if the current field's value is a valid alpha value.
func isAlpha ( fl FieldLevel ) bool {
func isAlpha ( fl FieldLevel ) bool {
return alphaRegex . MatchString ( fl . Field ( ) . String ( ) )
return alphaRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sAlphanumUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value.
// i sAlphanumUnicode is the validation function for validating if the current field's value is a valid alphanumeric unicode value.
func isAlphanumUnicode ( fl FieldLevel ) bool {
func isAlphanumUnicode ( fl FieldLevel ) bool {
return alphaUnicodeNumericRegex . MatchString ( fl . Field ( ) . String ( ) )
return alphaUnicodeNumericRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
// I sAlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value.
// i sAlphaUnicode is the validation function for validating if the current field's value is a valid alpha unicode value.
func isAlphaUnicode ( fl FieldLevel ) bool {
func isAlphaUnicode ( fl FieldLevel ) bool {
return alphaUnicodeRegex . MatchString ( fl . Field ( ) . String ( ) )
return alphaUnicodeRegex . MatchString ( fl . Field ( ) . String ( ) )
}
}
@ -1443,7 +1443,7 @@ func isDefault(fl FieldLevel) bool {
return ! hasValue ( fl )
return ! hasValue ( fl )
}
}
// H asValue is the validation function for validating if the current field's value is not the default static value.
// h asValue is the validation function for validating if the current field's value is not the default static value.
func hasValue ( fl FieldLevel ) bool {
func hasValue ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
switch field . Kind ( ) {
switch field . Kind ( ) {
@ -1541,7 +1541,7 @@ func requiredUnless(fl FieldLevel) bool {
return hasValue ( fl )
return hasValue ( fl )
}
}
// E xcludedWith is the validation function
// e xcludedWith is the validation function
// The field under validation must not be present or is empty if any of the other specified fields are present.
// The field under validation must not be present or is empty if any of the other specified fields are present.
func excludedWith ( fl FieldLevel ) bool {
func excludedWith ( fl FieldLevel ) bool {
params := parseOneOfParam2 ( fl . Param ( ) )
params := parseOneOfParam2 ( fl . Param ( ) )
@ -1553,7 +1553,7 @@ func excludedWith(fl FieldLevel) bool {
return true
return true
}
}
// R equiredWith is the validation function
// r equiredWith is the validation function
// The field under validation must be present and not empty only if any of the other specified fields are present.
// The field under validation must be present and not empty only if any of the other specified fields are present.
func requiredWith ( fl FieldLevel ) bool {
func requiredWith ( fl FieldLevel ) bool {
params := parseOneOfParam2 ( fl . Param ( ) )
params := parseOneOfParam2 ( fl . Param ( ) )
@ -1565,7 +1565,7 @@ func requiredWith(fl FieldLevel) bool {
return true
return true
}
}
// E xcludedWithAll is the validation function
// e xcludedWithAll is the validation function
// The field under validation must not be present or is empty if all of the other specified fields are present.
// The field under validation must not be present or is empty if all of the other specified fields are present.
func excludedWithAll ( fl FieldLevel ) bool {
func excludedWithAll ( fl FieldLevel ) bool {
params := parseOneOfParam2 ( fl . Param ( ) )
params := parseOneOfParam2 ( fl . Param ( ) )
@ -1577,7 +1577,7 @@ func excludedWithAll(fl FieldLevel) bool {
return ! hasValue ( fl )
return ! hasValue ( fl )
}
}
// R equiredWithAll is the validation function
// r equiredWithAll is the validation function
// The field under validation must be present and not empty only if all of the other specified fields are present.
// The field under validation must be present and not empty only if all of the other specified fields are present.
func requiredWithAll ( fl FieldLevel ) bool {
func requiredWithAll ( fl FieldLevel ) bool {
params := parseOneOfParam2 ( fl . Param ( ) )
params := parseOneOfParam2 ( fl . Param ( ) )
@ -1589,7 +1589,7 @@ func requiredWithAll(fl FieldLevel) bool {
return hasValue ( fl )
return hasValue ( fl )
}
}
// E xcludedWithout is the validation function
// e xcludedWithout is the validation function
// The field under validation must not be present or is empty when any of the other specified fields are not present.
// The field under validation must not be present or is empty when any of the other specified fields are not present.
func excludedWithout ( fl FieldLevel ) bool {
func excludedWithout ( fl FieldLevel ) bool {
if requireCheckFieldKind ( fl , strings . TrimSpace ( fl . Param ( ) ) , true ) {
if requireCheckFieldKind ( fl , strings . TrimSpace ( fl . Param ( ) ) , true ) {
@ -1598,7 +1598,7 @@ func excludedWithout(fl FieldLevel) bool {
return true
return true
}
}
// R equiredWithout is the validation function
// r equiredWithout is the validation function
// The field under validation must be present and not empty only when any of the other specified fields are not present.
// The field under validation must be present and not empty only when any of the other specified fields are not present.
func requiredWithout ( fl FieldLevel ) bool {
func requiredWithout ( fl FieldLevel ) bool {
if requireCheckFieldKind ( fl , strings . TrimSpace ( fl . Param ( ) ) , true ) {
if requireCheckFieldKind ( fl , strings . TrimSpace ( fl . Param ( ) ) , true ) {
@ -1607,7 +1607,7 @@ func requiredWithout(fl FieldLevel) bool {
return true
return true
}
}
// E xcludedWithoutAll is the validation function
// e xcludedWithoutAll is the validation function
// The field under validation must not be present or is empty when all of the other specified fields are not present.
// The field under validation must not be present or is empty when all of the other specified fields are not present.
func excludedWithoutAll ( fl FieldLevel ) bool {
func excludedWithoutAll ( fl FieldLevel ) bool {
params := parseOneOfParam2 ( fl . Param ( ) )
params := parseOneOfParam2 ( fl . Param ( ) )
@ -1619,7 +1619,7 @@ func excludedWithoutAll(fl FieldLevel) bool {
return ! hasValue ( fl )
return ! hasValue ( fl )
}
}
// R equiredWithoutAll is the validation function
// r equiredWithoutAll is the validation function
// The field under validation must be present and not empty only when all of the other specified fields are not present.
// The field under validation must be present and not empty only when all of the other specified fields are not present.
func requiredWithoutAll ( fl FieldLevel ) bool {
func requiredWithoutAll ( fl FieldLevel ) bool {
params := parseOneOfParam2 ( fl . Param ( ) )
params := parseOneOfParam2 ( fl . Param ( ) )
@ -1631,7 +1631,7 @@ func requiredWithoutAll(fl FieldLevel) bool {
return hasValue ( fl )
return hasValue ( fl )
}
}
// I sGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value.
// i sGteField is the validation function for validating if the current field's value is greater than or equal to the field specified by the param's value.
func isGteField ( fl FieldLevel ) bool {
func isGteField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1678,7 +1678,7 @@ func isGteField(fl FieldLevel) bool {
return len ( field . String ( ) ) >= len ( currentField . String ( ) )
return len ( field . String ( ) ) >= len ( currentField . String ( ) )
}
}
// I sGtField is the validation function for validating if the current field's value is greater than the field specified by the param's value.
// i sGtField is the validation function for validating if the current field's value is greater than the field specified by the param's value.
func isGtField ( fl FieldLevel ) bool {
func isGtField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1725,7 +1725,7 @@ func isGtField(fl FieldLevel) bool {
return len ( field . String ( ) ) > len ( currentField . String ( ) )
return len ( field . String ( ) ) > len ( currentField . String ( ) )
}
}
// I sGte is the validation function for validating if the current field's value is greater than or equal to the param's value.
// i sGte is the validation function for validating if the current field's value is greater than or equal to the param's value.
func isGte ( fl FieldLevel ) bool {
func isGte ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1772,7 +1772,7 @@ func isGte(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// I sGt is the validation function for validating if the current field's value is greater than the param's value.
// i sGt is the validation function for validating if the current field's value is greater than the param's value.
func isGt ( fl FieldLevel ) bool {
func isGt ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1815,7 +1815,7 @@ func isGt(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// H asLengthOf is the validation function for validating if the current field's value is equal to the param's value.
// h asLengthOf is the validation function for validating if the current field's value is equal to the param's value.
func hasLengthOf ( fl FieldLevel ) bool {
func hasLengthOf ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1852,12 +1852,12 @@ func hasLengthOf(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// H asMinOf is the validation function for validating if the current field's value is greater than or equal to the param's value.
// h asMinOf is the validation function for validating if the current field's value is greater than or equal to the param's value.
func hasMinOf ( fl FieldLevel ) bool {
func hasMinOf ( fl FieldLevel ) bool {
return isGte ( fl )
return isGte ( fl )
}
}
// I sLteField is the validation function for validating if the current field's value is less than or equal to the field specified by the param's value.
// i sLteField is the validation function for validating if the current field's value is less than or equal to the field specified by the param's value.
func isLteField ( fl FieldLevel ) bool {
func isLteField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1904,7 +1904,7 @@ func isLteField(fl FieldLevel) bool {
return len ( field . String ( ) ) <= len ( currentField . String ( ) )
return len ( field . String ( ) ) <= len ( currentField . String ( ) )
}
}
// I sLtField is the validation function for validating if the current field's value is less than the field specified by the param's value.
// i sLtField is the validation function for validating if the current field's value is less than the field specified by the param's value.
func isLtField ( fl FieldLevel ) bool {
func isLtField ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1951,7 +1951,7 @@ func isLtField(fl FieldLevel) bool {
return len ( field . String ( ) ) < len ( currentField . String ( ) )
return len ( field . String ( ) ) < len ( currentField . String ( ) )
}
}
// I sLte is the validation function for validating if the current field's value is less than or equal to the param's value.
// i sLte is the validation function for validating if the current field's value is less than or equal to the param's value.
func isLte ( fl FieldLevel ) bool {
func isLte ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -1998,7 +1998,7 @@ func isLte(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// I sLt is the validation function for validating if the current field's value is less than the param's value.
// i sLt is the validation function for validating if the current field's value is less than the param's value.
func isLt ( fl FieldLevel ) bool {
func isLt ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )
@ -2042,12 +2042,12 @@ func isLt(fl FieldLevel) bool {
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
panic ( fmt . Sprintf ( "Bad field type %T" , field . Interface ( ) ) )
}
}
// H asMaxOf is the validation function for validating if the current field's value is less than or equal to the param's value.
// h asMaxOf is the validation function for validating if the current field's value is less than or equal to the param's value.
func hasMaxOf ( fl FieldLevel ) bool {
func hasMaxOf ( fl FieldLevel ) bool {
return isLte ( fl )
return isLte ( fl )
}
}
// I sTCP4AddrResolvable is the validation function for validating if the field's value is a resolvable tcp4 address.
// i sTCP4AddrResolvable is the validation function for validating if the field's value is a resolvable tcp4 address.
func isTCP4AddrResolvable ( fl FieldLevel ) bool {
func isTCP4AddrResolvable ( fl FieldLevel ) bool {
if ! isIP4Addr ( fl ) {
if ! isIP4Addr ( fl ) {
@ -2058,7 +2058,7 @@ func isTCP4AddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sTCP6AddrResolvable is the validation function for validating if the field's value is a resolvable tcp6 address.
// i sTCP6AddrResolvable is the validation function for validating if the field's value is a resolvable tcp6 address.
func isTCP6AddrResolvable ( fl FieldLevel ) bool {
func isTCP6AddrResolvable ( fl FieldLevel ) bool {
if ! isIP6Addr ( fl ) {
if ! isIP6Addr ( fl ) {
@ -2070,7 +2070,7 @@ func isTCP6AddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sTCPAddrResolvable is the validation function for validating if the field's value is a resolvable tcp address.
// i sTCPAddrResolvable is the validation function for validating if the field's value is a resolvable tcp address.
func isTCPAddrResolvable ( fl FieldLevel ) bool {
func isTCPAddrResolvable ( fl FieldLevel ) bool {
if ! isIP4Addr ( fl ) && ! isIP6Addr ( fl ) {
if ! isIP4Addr ( fl ) && ! isIP6Addr ( fl ) {
@ -2082,7 +2082,7 @@ func isTCPAddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sUDP4AddrResolvable is the validation function for validating if the field's value is a resolvable udp4 address.
// i sUDP4AddrResolvable is the validation function for validating if the field's value is a resolvable udp4 address.
func isUDP4AddrResolvable ( fl FieldLevel ) bool {
func isUDP4AddrResolvable ( fl FieldLevel ) bool {
if ! isIP4Addr ( fl ) {
if ! isIP4Addr ( fl ) {
@ -2094,7 +2094,7 @@ func isUDP4AddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sUDP6AddrResolvable is the validation function for validating if the field's value is a resolvable udp6 address.
// i sUDP6AddrResolvable is the validation function for validating if the field's value is a resolvable udp6 address.
func isUDP6AddrResolvable ( fl FieldLevel ) bool {
func isUDP6AddrResolvable ( fl FieldLevel ) bool {
if ! isIP6Addr ( fl ) {
if ! isIP6Addr ( fl ) {
@ -2106,7 +2106,7 @@ func isUDP6AddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sUDPAddrResolvable is the validation function for validating if the field's value is a resolvable udp address.
// i sUDPAddrResolvable is the validation function for validating if the field's value is a resolvable udp address.
func isUDPAddrResolvable ( fl FieldLevel ) bool {
func isUDPAddrResolvable ( fl FieldLevel ) bool {
if ! isIP4Addr ( fl ) && ! isIP6Addr ( fl ) {
if ! isIP4Addr ( fl ) && ! isIP6Addr ( fl ) {
@ -2118,7 +2118,7 @@ func isUDPAddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sIP4AddrResolvable is the validation function for validating if the field's value is a resolvable ip4 address.
// i sIP4AddrResolvable is the validation function for validating if the field's value is a resolvable ip4 address.
func isIP4AddrResolvable ( fl FieldLevel ) bool {
func isIP4AddrResolvable ( fl FieldLevel ) bool {
if ! isIPv4 ( fl ) {
if ! isIPv4 ( fl ) {
@ -2130,7 +2130,7 @@ func isIP4AddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sIP6AddrResolvable is the validation function for validating if the field's value is a resolvable ip6 address.
// i sIP6AddrResolvable is the validation function for validating if the field's value is a resolvable ip6 address.
func isIP6AddrResolvable ( fl FieldLevel ) bool {
func isIP6AddrResolvable ( fl FieldLevel ) bool {
if ! isIPv6 ( fl ) {
if ! isIPv6 ( fl ) {
@ -2142,7 +2142,7 @@ func isIP6AddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sIPAddrResolvable is the validation function for validating if the field's value is a resolvable ip address.
// i sIPAddrResolvable is the validation function for validating if the field's value is a resolvable ip address.
func isIPAddrResolvable ( fl FieldLevel ) bool {
func isIPAddrResolvable ( fl FieldLevel ) bool {
if ! isIP ( fl ) {
if ! isIP ( fl ) {
@ -2154,7 +2154,7 @@ func isIPAddrResolvable(fl FieldLevel) bool {
return err == nil
return err == nil
}
}
// I sUnixAddrResolvable is the validation function for validating if the field's value is a resolvable unix address.
// i sUnixAddrResolvable is the validation function for validating if the field's value is a resolvable unix address.
func isUnixAddrResolvable ( fl FieldLevel ) bool {
func isUnixAddrResolvable ( fl FieldLevel ) bool {
_ , err := net . ResolveUnixAddr ( "unix" , fl . Field ( ) . String ( ) )
_ , err := net . ResolveUnixAddr ( "unix" , fl . Field ( ) . String ( ) )
@ -2208,7 +2208,7 @@ func isFQDN(fl FieldLevel) bool {
return fqdnRegexRFC1123 . MatchString ( val )
return fqdnRegexRFC1123 . MatchString ( val )
}
}
// I sDir is the validation function for validating if the current field's value is a valid directory.
// i sDir is the validation function for validating if the current field's value is a valid directory.
func isDir ( fl FieldLevel ) bool {
func isDir ( fl FieldLevel ) bool {
field := fl . Field ( )
field := fl . Field ( )