|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
Package validator implements value validations for structs and individual fields based on tags. It can also handle Cross Field validation and even Cross Field Cross Struct validation for nested structs. |
|
|
|
Package validator implements value validations for structs and individual fields based on tags. It can also handle Cross Field and Cross Struct validation for nested structs. |
|
|
|
|
|
|
|
|
|
|
|
Validate |
|
|
|
Validate |
|
|
|
|
|
|
|
|
|
|
@ -250,55 +250,55 @@ Here is a list of the current built in validators: |
|
|
|
Validating by field validate.FieldWithValue(start, end, "ltefield") |
|
|
|
Validating by field validate.FieldWithValue(start, end, "ltefield") |
|
|
|
|
|
|
|
|
|
|
|
alpha |
|
|
|
alpha |
|
|
|
This validates that a strings value contains alpha characters only |
|
|
|
This validates that a string value contains alpha characters only |
|
|
|
(Usage: alpha) |
|
|
|
(Usage: alpha) |
|
|
|
|
|
|
|
|
|
|
|
alphanum |
|
|
|
alphanum |
|
|
|
This validates that a strings value contains alphanumeric characters only |
|
|
|
This validates that a string value contains alphanumeric characters only |
|
|
|
(Usage: alphanum) |
|
|
|
(Usage: alphanum) |
|
|
|
|
|
|
|
|
|
|
|
numeric |
|
|
|
numeric |
|
|
|
This validates that a strings value contains a basic numeric value. |
|
|
|
This validates that a string value contains a basic numeric value. |
|
|
|
basic excludes exponents etc... |
|
|
|
basic excludes exponents etc... |
|
|
|
(Usage: numeric) |
|
|
|
(Usage: numeric) |
|
|
|
|
|
|
|
|
|
|
|
hexadecimal |
|
|
|
hexadecimal |
|
|
|
This validates that a strings value contains a valid hexadecimal. |
|
|
|
This validates that a string value contains a valid hexadecimal. |
|
|
|
(Usage: hexadecimal) |
|
|
|
(Usage: hexadecimal) |
|
|
|
|
|
|
|
|
|
|
|
hexcolor |
|
|
|
hexcolor |
|
|
|
This validates that a strings value contains a valid hex color including |
|
|
|
This validates that a string value contains a valid hex color including |
|
|
|
hashtag (#) |
|
|
|
hashtag (#) |
|
|
|
(Usage: hexcolor) |
|
|
|
(Usage: hexcolor) |
|
|
|
|
|
|
|
|
|
|
|
rgb |
|
|
|
rgb |
|
|
|
This validates that a strings value contains a valid rgb color |
|
|
|
This validates that a string value contains a valid rgb color |
|
|
|
(Usage: rgb) |
|
|
|
(Usage: rgb) |
|
|
|
|
|
|
|
|
|
|
|
rgba |
|
|
|
rgba |
|
|
|
This validates that a strings value contains a valid rgba color |
|
|
|
This validates that a string value contains a valid rgba color |
|
|
|
(Usage: rgba) |
|
|
|
(Usage: rgba) |
|
|
|
|
|
|
|
|
|
|
|
hsl |
|
|
|
hsl |
|
|
|
This validates that a strings value contains a valid hsl color |
|
|
|
This validates that a string value contains a valid hsl color |
|
|
|
(Usage: hsl) |
|
|
|
(Usage: hsl) |
|
|
|
|
|
|
|
|
|
|
|
hsla |
|
|
|
hsla |
|
|
|
This validates that a strings value contains a valid hsla color |
|
|
|
This validates that a string value contains a valid hsla color |
|
|
|
(Usage: hsla) |
|
|
|
(Usage: hsla) |
|
|
|
|
|
|
|
|
|
|
|
email |
|
|
|
email |
|
|
|
This validates that a strings value contains a valid email |
|
|
|
This validates that a string value contains a valid email |
|
|
|
This may not conform to all possibilities of any rfc standard, but neither |
|
|
|
This may not conform to all possibilities of any rfc standard, but neither |
|
|
|
does any email provider accept all posibilities... |
|
|
|
does any email provider accept all posibilities... |
|
|
|
(Usage: email) |
|
|
|
(Usage: email) |
|
|
|
url |
|
|
|
url |
|
|
|
This validates that a strings value contains a valid url |
|
|
|
This validates that a string value contains a valid url |
|
|
|
This will accept any url the golang request uri accepts but must contain |
|
|
|
This will accept any url the golang request uri accepts but must contain |
|
|
|
a schema for example http:// or rtmp://
|
|
|
|
a schema for example http:// or rtmp://
|
|
|
|
(Usage: url) |
|
|
|
(Usage: url) |
|
|
|
uri |
|
|
|
uri |
|
|
|
This validates that a strings value contains a valid uri |
|
|
|
This validates that a string value contains a valid uri |
|
|
|
This will accept any uri the golang request uri accepts (Usage: uri) |
|
|
|
This will accept any uri the golang request uri accepts (Usage: uri) |
|
|
|
|
|
|
|
|
|
|
|
Validator notes: |
|
|
|
Validator notes: |
|
|
@ -314,7 +314,7 @@ Validator notes: |
|
|
|
used within the validator function and even be precompiled for better efficiency |
|
|
|
used within the validator function and even be precompiled for better efficiency |
|
|
|
within regexes.go. |
|
|
|
within regexes.go. |
|
|
|
|
|
|
|
|
|
|
|
And the best reason, you can sumit a pull request and we can keep on adding to the |
|
|
|
And the best reason, you can submit a pull request and we can keep on adding to the |
|
|
|
validation library of this package! |
|
|
|
validation library of this package! |
|
|
|
|
|
|
|
|
|
|
|
Panics |
|
|
|
Panics |
|
|
|