mirror of
https://github.com/datarhei/core.git
synced 2025-10-06 16:37:04 +08:00
Update dependencies
This commit is contained in:
3
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
3
vendor/github.com/go-playground/validator/v10/README.md
generated
vendored
@@ -1,7 +1,7 @@
|
||||
Package validator
|
||||
=================
|
||||
<img align="right" src="logo.png">[](https://gitter.im/go-playground/validator?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||

|
||||

|
||||
[](https://travis-ci.org/go-playground/validator)
|
||||
[](https://coveralls.io/github/go-playground/validator?branch=master)
|
||||
[](https://goreportcard.com/report/github.com/go-playground/validator)
|
||||
@@ -163,6 +163,7 @@ validate := validator.New(validator.WithRequiredStructEnabled())
|
||||
| btc_addr_bech32 | Bitcoin Bech32 Address (segwit) |
|
||||
| credit_card | Credit Card Number |
|
||||
| mongodb | MongoDB ObjectID |
|
||||
| mongodb_connection_string | MongoDB Connection String |
|
||||
| cron | Cron |
|
||||
| spicedb | SpiceDb ObjectID/Permission/Type |
|
||||
| datetime | Datetime |
|
||||
|
53
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
53
vendor/github.com/go-playground/validator/v10/baked_in.go
generated
vendored
@@ -235,7 +235,8 @@ var (
|
||||
"credit_card": isCreditCard,
|
||||
"cve": isCveFormat,
|
||||
"luhn_checksum": hasLuhnChecksum,
|
||||
"mongodb": isMongoDB,
|
||||
"mongodb": isMongoDBObjectId,
|
||||
"mongodb_connection_string": isMongoDBConnectionString,
|
||||
"cron": isCron,
|
||||
"spicedb": isSpiceDB,
|
||||
}
|
||||
@@ -690,7 +691,7 @@ func isEthereumAddress(fl FieldLevel) bool {
|
||||
return ethAddressRegex.MatchString(address)
|
||||
}
|
||||
|
||||
// isEthereumAddressChecksum is the validation function for validating if the field's value is a valid checksumed Ethereum address.
|
||||
// isEthereumAddressChecksum is the validation function for validating if the field's value is a valid checksummed Ethereum address.
|
||||
func isEthereumAddressChecksum(fl FieldLevel) bool {
|
||||
address := fl.Field().String()
|
||||
|
||||
@@ -2768,26 +2769,26 @@ func isTimeZone(fl FieldLevel) bool {
|
||||
|
||||
// isIso3166Alpha2 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-2 country code.
|
||||
func isIso3166Alpha2(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return iso3166_1_alpha2[val]
|
||||
_, ok := iso3166_1_alpha2[fl.Field().String()]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso3166Alpha2EU is the validation function for validating if the current field's value is a valid iso3166-1 alpha-2 European Union country code.
|
||||
func isIso3166Alpha2EU(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return iso3166_1_alpha2_eu[val]
|
||||
_, ok := iso3166_1_alpha2_eu[fl.Field().String()]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso3166Alpha3 is the validation function for validating if the current field's value is a valid iso3166-1 alpha-3 country code.
|
||||
func isIso3166Alpha3(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return iso3166_1_alpha3[val]
|
||||
_, ok := iso3166_1_alpha3[fl.Field().String()]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso3166Alpha3EU is the validation function for validating if the current field's value is a valid iso3166-1 alpha-3 European Union country code.
|
||||
func isIso3166Alpha3EU(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return iso3166_1_alpha3_eu[val]
|
||||
_, ok := iso3166_1_alpha3_eu[fl.Field().String()]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso3166AlphaNumeric is the validation function for validating if the current field's value is a valid iso3166-1 alpha-numeric country code.
|
||||
@@ -2809,7 +2810,9 @@ func isIso3166AlphaNumeric(fl FieldLevel) bool {
|
||||
default:
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
}
|
||||
return iso3166_1_alpha_numeric[code]
|
||||
|
||||
_, ok := iso3166_1_alpha_numeric[code]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso3166AlphaNumericEU is the validation function for validating if the current field's value is a valid iso3166-1 alpha-numeric European Union country code.
|
||||
@@ -2831,19 +2834,21 @@ func isIso3166AlphaNumericEU(fl FieldLevel) bool {
|
||||
default:
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
}
|
||||
return iso3166_1_alpha_numeric_eu[code]
|
||||
|
||||
_, ok := iso3166_1_alpha_numeric_eu[code]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso31662 is the validation function for validating if the current field's value is a valid iso3166-2 code.
|
||||
func isIso31662(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return iso3166_2[val]
|
||||
_, ok := iso3166_2[fl.Field().String()]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso4217 is the validation function for validating if the current field's value is a valid iso4217 currency code.
|
||||
func isIso4217(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return iso4217[val]
|
||||
_, ok := iso4217[fl.Field().String()]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isIso4217Numeric is the validation function for validating if the current field's value is a valid iso4217 numeric currency code.
|
||||
@@ -2859,7 +2864,9 @@ func isIso4217Numeric(fl FieldLevel) bool {
|
||||
default:
|
||||
panic(fmt.Sprintf("Bad field type %T", field.Interface()))
|
||||
}
|
||||
return iso4217_numeric[code]
|
||||
|
||||
_, ok := iso4217_numeric[code]
|
||||
return ok
|
||||
}
|
||||
|
||||
// isBCP47LanguageTag is the validation function for validating if the current field's value is a valid BCP 47 language tag, as parsed by language.Parse
|
||||
@@ -2926,10 +2933,16 @@ func digitsHaveLuhnChecksum(digits []string) bool {
|
||||
return (sum % 10) == 0
|
||||
}
|
||||
|
||||
// isMongoDB is the validation function for validating if the current field's value is valid mongoDB objectID
|
||||
func isMongoDB(fl FieldLevel) bool {
|
||||
// isMongoDBObjectId is the validation function for validating if the current field's value is valid MongoDB ObjectID
|
||||
func isMongoDBObjectId(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return mongodbRegex.MatchString(val)
|
||||
return mongodbIdRegex.MatchString(val)
|
||||
}
|
||||
|
||||
// isMongoDBConnectionString is the validation function for validating if the current field's value is valid MongoDB Connection String
|
||||
func isMongoDBConnectionString(fl FieldLevel) bool {
|
||||
val := fl.Field().String()
|
||||
return mongodbConnectionRegex.MatchString(val)
|
||||
}
|
||||
|
||||
// isSpiceDB is the validation function for validating if the current field's value is valid for use with Authzed SpiceDB in the indicated way
|
||||
|
2
vendor/github.com/go-playground/validator/v10/cache.go
generated
vendored
2
vendor/github.com/go-playground/validator/v10/cache.go
generated
vendored
@@ -294,7 +294,7 @@ func (v *Validate) parseFieldTagsRecursive(tag string, fieldName string, alias s
|
||||
|
||||
if wrapper, ok := v.validations[current.tag]; ok {
|
||||
current.fn = wrapper.fn
|
||||
current.runValidationWhenNil = wrapper.runValidatinOnNil
|
||||
current.runValidationWhenNil = wrapper.runValidationOnNil
|
||||
} else {
|
||||
panic(strings.TrimSpace(fmt.Sprintf(undefinedValidation, current.tag, fieldName)))
|
||||
}
|
||||
|
2320
vendor/github.com/go-playground/validator/v10/country_codes.go
generated
vendored
2320
vendor/github.com/go-playground/validator/v10/country_codes.go
generated
vendored
File diff suppressed because it is too large
Load Diff
148
vendor/github.com/go-playground/validator/v10/currency_codes.go
generated
vendored
148
vendor/github.com/go-playground/validator/v10/currency_codes.go
generated
vendored
@@ -1,79 +1,79 @@
|
||||
package validator
|
||||
|
||||
var iso4217 = map[string]bool{
|
||||
"AFN": true, "EUR": true, "ALL": true, "DZD": true, "USD": true,
|
||||
"AOA": true, "XCD": true, "ARS": true, "AMD": true, "AWG": true,
|
||||
"AUD": true, "AZN": true, "BSD": true, "BHD": true, "BDT": true,
|
||||
"BBD": true, "BYN": true, "BZD": true, "XOF": true, "BMD": true,
|
||||
"INR": true, "BTN": true, "BOB": true, "BOV": true, "BAM": true,
|
||||
"BWP": true, "NOK": true, "BRL": true, "BND": true, "BGN": true,
|
||||
"BIF": true, "CVE": true, "KHR": true, "XAF": true, "CAD": true,
|
||||
"KYD": true, "CLP": true, "CLF": true, "CNY": true, "COP": true,
|
||||
"COU": true, "KMF": true, "CDF": true, "NZD": true, "CRC": true,
|
||||
"HRK": true, "CUP": true, "CUC": true, "ANG": true, "CZK": true,
|
||||
"DKK": true, "DJF": true, "DOP": true, "EGP": true, "SVC": true,
|
||||
"ERN": true, "SZL": true, "ETB": true, "FKP": true, "FJD": true,
|
||||
"XPF": true, "GMD": true, "GEL": true, "GHS": true, "GIP": true,
|
||||
"GTQ": true, "GBP": true, "GNF": true, "GYD": true, "HTG": true,
|
||||
"HNL": true, "HKD": true, "HUF": true, "ISK": true, "IDR": true,
|
||||
"XDR": true, "IRR": true, "IQD": true, "ILS": true, "JMD": true,
|
||||
"JPY": true, "JOD": true, "KZT": true, "KES": true, "KPW": true,
|
||||
"KRW": true, "KWD": true, "KGS": true, "LAK": true, "LBP": true,
|
||||
"LSL": true, "ZAR": true, "LRD": true, "LYD": true, "CHF": true,
|
||||
"MOP": true, "MKD": true, "MGA": true, "MWK": true, "MYR": true,
|
||||
"MVR": true, "MRU": true, "MUR": true, "XUA": true, "MXN": true,
|
||||
"MXV": true, "MDL": true, "MNT": true, "MAD": true, "MZN": true,
|
||||
"MMK": true, "NAD": true, "NPR": true, "NIO": true, "NGN": true,
|
||||
"OMR": true, "PKR": true, "PAB": true, "PGK": true, "PYG": true,
|
||||
"PEN": true, "PHP": true, "PLN": true, "QAR": true, "RON": true,
|
||||
"RUB": true, "RWF": true, "SHP": true, "WST": true, "STN": true,
|
||||
"SAR": true, "RSD": true, "SCR": true, "SLL": true, "SGD": true,
|
||||
"XSU": true, "SBD": true, "SOS": true, "SSP": true, "LKR": true,
|
||||
"SDG": true, "SRD": true, "SEK": true, "CHE": true, "CHW": true,
|
||||
"SYP": true, "TWD": true, "TJS": true, "TZS": true, "THB": true,
|
||||
"TOP": true, "TTD": true, "TND": true, "TRY": true, "TMT": true,
|
||||
"UGX": true, "UAH": true, "AED": true, "USN": true, "UYU": true,
|
||||
"UYI": true, "UYW": true, "UZS": true, "VUV": true, "VES": true,
|
||||
"VND": true, "YER": true, "ZMW": true, "ZWL": true, "XBA": true,
|
||||
"XBB": true, "XBC": true, "XBD": true, "XTS": true, "XXX": true,
|
||||
"XAU": true, "XPD": true, "XPT": true, "XAG": true,
|
||||
var iso4217 = map[string]struct{}{
|
||||
"AFN": {}, "EUR": {}, "ALL": {}, "DZD": {}, "USD": {},
|
||||
"AOA": {}, "XCD": {}, "ARS": {}, "AMD": {}, "AWG": {},
|
||||
"AUD": {}, "AZN": {}, "BSD": {}, "BHD": {}, "BDT": {},
|
||||
"BBD": {}, "BYN": {}, "BZD": {}, "XOF": {}, "BMD": {},
|
||||
"INR": {}, "BTN": {}, "BOB": {}, "BOV": {}, "BAM": {},
|
||||
"BWP": {}, "NOK": {}, "BRL": {}, "BND": {}, "BGN": {},
|
||||
"BIF": {}, "CVE": {}, "KHR": {}, "XAF": {}, "CAD": {},
|
||||
"KYD": {}, "CLP": {}, "CLF": {}, "CNY": {}, "COP": {},
|
||||
"COU": {}, "KMF": {}, "CDF": {}, "NZD": {}, "CRC": {},
|
||||
"HRK": {}, "CUP": {}, "CUC": {}, "ANG": {}, "CZK": {},
|
||||
"DKK": {}, "DJF": {}, "DOP": {}, "EGP": {}, "SVC": {},
|
||||
"ERN": {}, "SZL": {}, "ETB": {}, "FKP": {}, "FJD": {},
|
||||
"XPF": {}, "GMD": {}, "GEL": {}, "GHS": {}, "GIP": {},
|
||||
"GTQ": {}, "GBP": {}, "GNF": {}, "GYD": {}, "HTG": {},
|
||||
"HNL": {}, "HKD": {}, "HUF": {}, "ISK": {}, "IDR": {},
|
||||
"XDR": {}, "IRR": {}, "IQD": {}, "ILS": {}, "JMD": {},
|
||||
"JPY": {}, "JOD": {}, "KZT": {}, "KES": {}, "KPW": {},
|
||||
"KRW": {}, "KWD": {}, "KGS": {}, "LAK": {}, "LBP": {},
|
||||
"LSL": {}, "ZAR": {}, "LRD": {}, "LYD": {}, "CHF": {},
|
||||
"MOP": {}, "MKD": {}, "MGA": {}, "MWK": {}, "MYR": {},
|
||||
"MVR": {}, "MRU": {}, "MUR": {}, "XUA": {}, "MXN": {},
|
||||
"MXV": {}, "MDL": {}, "MNT": {}, "MAD": {}, "MZN": {},
|
||||
"MMK": {}, "NAD": {}, "NPR": {}, "NIO": {}, "NGN": {},
|
||||
"OMR": {}, "PKR": {}, "PAB": {}, "PGK": {}, "PYG": {},
|
||||
"PEN": {}, "PHP": {}, "PLN": {}, "QAR": {}, "RON": {},
|
||||
"RUB": {}, "RWF": {}, "SHP": {}, "WST": {}, "STN": {},
|
||||
"SAR": {}, "RSD": {}, "SCR": {}, "SLL": {}, "SGD": {},
|
||||
"XSU": {}, "SBD": {}, "SOS": {}, "SSP": {}, "LKR": {},
|
||||
"SDG": {}, "SRD": {}, "SEK": {}, "CHE": {}, "CHW": {},
|
||||
"SYP": {}, "TWD": {}, "TJS": {}, "TZS": {}, "THB": {},
|
||||
"TOP": {}, "TTD": {}, "TND": {}, "TRY": {}, "TMT": {},
|
||||
"UGX": {}, "UAH": {}, "AED": {}, "USN": {}, "UYU": {},
|
||||
"UYI": {}, "UYW": {}, "UZS": {}, "VUV": {}, "VES": {},
|
||||
"VND": {}, "YER": {}, "ZMW": {}, "ZWL": {}, "XBA": {},
|
||||
"XBB": {}, "XBC": {}, "XBD": {}, "XTS": {}, "XXX": {},
|
||||
"XAU": {}, "XPD": {}, "XPT": {}, "XAG": {},
|
||||
}
|
||||
|
||||
var iso4217_numeric = map[int]bool{
|
||||
8: true, 12: true, 32: true, 36: true, 44: true,
|
||||
48: true, 50: true, 51: true, 52: true, 60: true,
|
||||
64: true, 68: true, 72: true, 84: true, 90: true,
|
||||
96: true, 104: true, 108: true, 116: true, 124: true,
|
||||
132: true, 136: true, 144: true, 152: true, 156: true,
|
||||
170: true, 174: true, 188: true, 191: true, 192: true,
|
||||
203: true, 208: true, 214: true, 222: true, 230: true,
|
||||
232: true, 238: true, 242: true, 262: true, 270: true,
|
||||
292: true, 320: true, 324: true, 328: true, 332: true,
|
||||
340: true, 344: true, 348: true, 352: true, 356: true,
|
||||
360: true, 364: true, 368: true, 376: true, 388: true,
|
||||
392: true, 398: true, 400: true, 404: true, 408: true,
|
||||
410: true, 414: true, 417: true, 418: true, 422: true,
|
||||
426: true, 430: true, 434: true, 446: true, 454: true,
|
||||
458: true, 462: true, 480: true, 484: true, 496: true,
|
||||
498: true, 504: true, 512: true, 516: true, 524: true,
|
||||
532: true, 533: true, 548: true, 554: true, 558: true,
|
||||
566: true, 578: true, 586: true, 590: true, 598: true,
|
||||
600: true, 604: true, 608: true, 634: true, 643: true,
|
||||
646: true, 654: true, 682: true, 690: true, 694: true,
|
||||
702: true, 704: true, 706: true, 710: true, 728: true,
|
||||
748: true, 752: true, 756: true, 760: true, 764: true,
|
||||
776: true, 780: true, 784: true, 788: true, 800: true,
|
||||
807: true, 818: true, 826: true, 834: true, 840: true,
|
||||
858: true, 860: true, 882: true, 886: true, 901: true,
|
||||
927: true, 928: true, 929: true, 930: true, 931: true,
|
||||
932: true, 933: true, 934: true, 936: true, 938: true,
|
||||
940: true, 941: true, 943: true, 944: true, 946: true,
|
||||
947: true, 948: true, 949: true, 950: true, 951: true,
|
||||
952: true, 953: true, 955: true, 956: true, 957: true,
|
||||
958: true, 959: true, 960: true, 961: true, 962: true,
|
||||
963: true, 964: true, 965: true, 967: true, 968: true,
|
||||
969: true, 970: true, 971: true, 972: true, 973: true,
|
||||
975: true, 976: true, 977: true, 978: true, 979: true,
|
||||
980: true, 981: true, 984: true, 985: true, 986: true,
|
||||
990: true, 994: true, 997: true, 999: true,
|
||||
var iso4217_numeric = map[int]struct{}{
|
||||
8: {}, 12: {}, 32: {}, 36: {}, 44: {},
|
||||
48: {}, 50: {}, 51: {}, 52: {}, 60: {},
|
||||
64: {}, 68: {}, 72: {}, 84: {}, 90: {},
|
||||
96: {}, 104: {}, 108: {}, 116: {}, 124: {},
|
||||
132: {}, 136: {}, 144: {}, 152: {}, 156: {},
|
||||
170: {}, 174: {}, 188: {}, 191: {}, 192: {},
|
||||
203: {}, 208: {}, 214: {}, 222: {}, 230: {},
|
||||
232: {}, 238: {}, 242: {}, 262: {}, 270: {},
|
||||
292: {}, 320: {}, 324: {}, 328: {}, 332: {},
|
||||
340: {}, 344: {}, 348: {}, 352: {}, 356: {},
|
||||
360: {}, 364: {}, 368: {}, 376: {}, 388: {},
|
||||
392: {}, 398: {}, 400: {}, 404: {}, 408: {},
|
||||
410: {}, 414: {}, 417: {}, 418: {}, 422: {},
|
||||
426: {}, 430: {}, 434: {}, 446: {}, 454: {},
|
||||
458: {}, 462: {}, 480: {}, 484: {}, 496: {},
|
||||
498: {}, 504: {}, 512: {}, 516: {}, 524: {},
|
||||
532: {}, 533: {}, 548: {}, 554: {}, 558: {},
|
||||
566: {}, 578: {}, 586: {}, 590: {}, 598: {},
|
||||
600: {}, 604: {}, 608: {}, 634: {}, 643: {},
|
||||
646: {}, 654: {}, 682: {}, 690: {}, 694: {},
|
||||
702: {}, 704: {}, 706: {}, 710: {}, 728: {},
|
||||
748: {}, 752: {}, 756: {}, 760: {}, 764: {},
|
||||
776: {}, 780: {}, 784: {}, 788: {}, 800: {},
|
||||
807: {}, 818: {}, 826: {}, 834: {}, 840: {},
|
||||
858: {}, 860: {}, 882: {}, 886: {}, 901: {},
|
||||
927: {}, 928: {}, 929: {}, 930: {}, 931: {},
|
||||
932: {}, 933: {}, 934: {}, 936: {}, 938: {},
|
||||
940: {}, 941: {}, 943: {}, 944: {}, 946: {},
|
||||
947: {}, 948: {}, 949: {}, 950: {}, 951: {},
|
||||
952: {}, 953: {}, 955: {}, 956: {}, 957: {},
|
||||
958: {}, 959: {}, 960: {}, 961: {}, 962: {},
|
||||
963: {}, 964: {}, 965: {}, 967: {}, 968: {},
|
||||
969: {}, 970: {}, 971: {}, 972: {}, 973: {},
|
||||
975: {}, 976: {}, 977: {}, 978: {}, 979: {},
|
||||
980: {}, 981: {}, 984: {}, 985: {}, 986: {},
|
||||
990: {}, 994: {}, 997: {}, 999: {},
|
||||
}
|
||||
|
20
vendor/github.com/go-playground/validator/v10/doc.go
generated
vendored
20
vendor/github.com/go-playground/validator/v10/doc.go
generated
vendored
@@ -253,7 +253,7 @@ Example #2
|
||||
|
||||
This validates that the value is not the data types default zero value.
|
||||
For numbers ensures value is not zero. For strings ensures value is
|
||||
not "". For slices, maps, pointers, interfaces, channels and functions
|
||||
not "". For booleans ensures value is not false. For slices, maps, pointers, interfaces, channels and functions
|
||||
ensures the value is not nil. For structs ensures value is not the zero value when using WithRequiredStructEnabled.
|
||||
|
||||
Usage: required
|
||||
@@ -911,7 +911,7 @@ This will accept any uri the golang request uri accepts
|
||||
|
||||
# Urn RFC 2141 String
|
||||
|
||||
This validataes that a string value contains a valid URN
|
||||
This validates that a string value contains a valid URN
|
||||
according to the RFC 2141 spec.
|
||||
|
||||
Usage: urn_rfc2141
|
||||
@@ -966,7 +966,7 @@ Bitcoin Bech32 Address (segwit)
|
||||
|
||||
This validates that a string value contains a valid bitcoin Bech32 address as defined
|
||||
by bip-0173 (https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki)
|
||||
Special thanks to Pieter Wuille for providng reference implementations.
|
||||
Special thanks to Pieter Wuille for providing reference implementations.
|
||||
|
||||
Usage: btc_addr_bech32
|
||||
|
||||
@@ -1299,7 +1299,7 @@ may not exist at the time of validation.
|
||||
# HostPort
|
||||
|
||||
This validates that a string value contains a valid DNS hostname and port that
|
||||
can be used to valiate fields typically passed to sockets and connections.
|
||||
can be used to validate fields typically passed to sockets and connections.
|
||||
|
||||
Usage: hostname_port
|
||||
|
||||
@@ -1386,11 +1386,19 @@ This validates that a string value contains a valid credit card number using Luh
|
||||
|
||||
This validates that a string or (u)int value contains a valid checksum using the Luhn algorithm.
|
||||
|
||||
# MongoDb ObjectID
|
||||
# MongoDB
|
||||
|
||||
This validates that a string is a valid 24 character hexadecimal string.
|
||||
This validates that a string is a valid 24 character hexadecimal string or valid connection string.
|
||||
|
||||
Usage: mongodb
|
||||
mongodb_connection_string
|
||||
|
||||
Example:
|
||||
|
||||
type Test struct {
|
||||
ObjectIdField string `validate:"mongodb"`
|
||||
ConnectionStringField string `validate:"mongodb_connection_string"`
|
||||
}
|
||||
|
||||
# Cron
|
||||
|
||||
|
6
vendor/github.com/go-playground/validator/v10/regexes.go
generated
vendored
6
vendor/github.com/go-playground/validator/v10/regexes.go
generated
vendored
@@ -68,7 +68,8 @@ const (
|
||||
semverRegexString = `^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$` // numbered capture groups https://semver.org/
|
||||
dnsRegexStringRFC1035Label = "^[a-z]([-a-z0-9]*[a-z0-9]){0,62}$"
|
||||
cveRegexString = `^CVE-(1999|2\d{3})-(0[^0]\d{2}|0\d[^0]\d{1}|0\d{2}[^0]|[1-9]{1}\d{3,})$` // CVE Format Id https://cve.mitre.org/cve/identifiers/syntaxchange.html
|
||||
mongodbRegexString = "^[a-f\\d]{24}$"
|
||||
mongodbIdRegexString = "^[a-f\\d]{24}$"
|
||||
mongodbConnStringRegexString = "^mongodb(\\+srv)?:\\/\\/(([a-zA-Z\\d]+):([a-zA-Z\\d$:\\/?#\\[\\]@]+)@)?(([a-z\\d.-]+)(:[\\d]+)?)((,(([a-z\\d.-]+)(:(\\d+))?))*)?(\\/[a-zA-Z-_]{1,64})?(\\?(([a-zA-Z]+)=([a-zA-Z\\d]+))(&(([a-zA-Z\\d]+)=([a-zA-Z\\d]+))?)*)?$"
|
||||
cronRegexString = `(@(annually|yearly|monthly|weekly|daily|hourly|reboot))|(@every (\d+(ns|us|µs|ms|s|m|h))+)|((((\d+,)+\d+|(\d+(\/|-)\d+)|\d+|\*) ?){5,7})`
|
||||
spicedbIDRegexString = `^(([a-zA-Z0-9/_|\-=+]{1,})|\*)$`
|
||||
spicedbPermissionRegexString = "^([a-z][a-z0-9_]{1,62}[a-z0-9])?$"
|
||||
@@ -139,7 +140,8 @@ var (
|
||||
semverRegex = regexp.MustCompile(semverRegexString)
|
||||
dnsRegexRFC1035Label = regexp.MustCompile(dnsRegexStringRFC1035Label)
|
||||
cveRegex = regexp.MustCompile(cveRegexString)
|
||||
mongodbRegex = regexp.MustCompile(mongodbRegexString)
|
||||
mongodbIdRegex = regexp.MustCompile(mongodbIdRegexString)
|
||||
mongodbConnectionRegex = regexp.MustCompile(mongodbConnStringRegexString)
|
||||
cronRegex = regexp.MustCompile(cronRegexString)
|
||||
spicedbIDRegex = regexp.MustCompile(spicedbIDRegexString)
|
||||
spicedbPermissionRegex = regexp.MustCompile(spicedbPermissionRegexString)
|
||||
|
2
vendor/github.com/go-playground/validator/v10/util.go
generated
vendored
2
vendor/github.com/go-playground/validator/v10/util.go
generated
vendored
@@ -271,7 +271,7 @@ func asFloat64(param string) float64 {
|
||||
return i
|
||||
}
|
||||
|
||||
// asFloat64 returns the parameter as a float64
|
||||
// asFloat32 returns the parameter as a float32
|
||||
// or panics if it can't convert
|
||||
func asFloat32(param string) float64 {
|
||||
i, err := strconv.ParseFloat(param, 32)
|
||||
|
8
vendor/github.com/go-playground/validator/v10/validator_instance.go
generated
vendored
8
vendor/github.com/go-playground/validator/v10/validator_instance.go
generated
vendored
@@ -74,8 +74,8 @@ type CustomTypeFunc func(field reflect.Value) interface{}
|
||||
type TagNameFunc func(field reflect.StructField) string
|
||||
|
||||
type internalValidationFuncWrapper struct {
|
||||
fn FuncCtx
|
||||
runValidatinOnNil bool
|
||||
fn FuncCtx
|
||||
runValidationOnNil bool
|
||||
}
|
||||
|
||||
// Validate contains the validator settings and cache
|
||||
@@ -245,7 +245,7 @@ func (v *Validate) registerValidation(tag string, fn FuncCtx, bakedIn bool, nilC
|
||||
if !bakedIn && (ok || strings.ContainsAny(tag, restrictedTagChars)) {
|
||||
panic(fmt.Sprintf(restrictedTagErr, tag))
|
||||
}
|
||||
v.validations[tag] = internalValidationFuncWrapper{fn: fn, runValidatinOnNil: nilCheckable}
|
||||
v.validations[tag] = internalValidationFuncWrapper{fn: fn, runValidationOnNil: nilCheckable}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -676,7 +676,7 @@ func (v *Validate) VarWithValue(field interface{}, other interface{}, tag string
|
||||
}
|
||||
|
||||
// VarWithValueCtx validates a single variable, against another variable/field's value using tag style validation and
|
||||
// allows passing of contextual validation validation information via context.Context.
|
||||
// allows passing of contextual validation information via context.Context.
|
||||
// eg.
|
||||
// s1 := "abcd"
|
||||
// s2 := "abcd"
|
||||
|
Reference in New Issue
Block a user