summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-playground/validator/v10/doc.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-playground/validator/v10/doc.go')
-rw-r--r--vendor/github.com/go-playground/validator/v10/doc.go29
1 files changed, 22 insertions, 7 deletions
diff --git a/vendor/github.com/go-playground/validator/v10/doc.go b/vendor/github.com/go-playground/validator/v10/doc.go
index 2e8092a90..c9b1616ee 100644
--- a/vendor/github.com/go-playground/validator/v10/doc.go
+++ b/vendor/github.com/go-playground/validator/v10/doc.go
@@ -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
@@ -489,12 +489,19 @@ For strings, ints, and uints, oneof will ensure that the value
is one of the values in the parameter. The parameter should be
a list of values separated by whitespace. Values may be
strings or numbers. To match strings with spaces in them, include
-the target string between single quotes.
+the target string between single quotes. Kind of like an 'enum'.
Usage: oneof=red green
oneof='red green' 'blue yellow'
oneof=5 7 9
+# One Of Case Insensitive
+
+Works the same as oneof but is case insensitive and therefore only accepts strings.
+
+ Usage: oneofci=red green
+ oneofci='red green' 'blue yellow'
+
# Greater Than
For numbers, this will ensure that the value is greater than the
@@ -911,7 +918,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 +973,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 +1306,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 +1393,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