|
|
@ -31,7 +31,7 @@ Custom Validation Functions |
|
|
|
Custom Validation functions can be added. Example: |
|
|
|
Custom Validation functions can be added. Example: |
|
|
|
|
|
|
|
|
|
|
|
// Structure
|
|
|
|
// Structure
|
|
|
|
func customFunc(fl FieldLevel) bool { |
|
|
|
func customFunc(fl validator.FieldLevel) bool { |
|
|
|
|
|
|
|
|
|
|
|
if fl.Field().String() == "invalid" { |
|
|
|
if fl.Field().String() == "invalid" { |
|
|
|
return false |
|
|
|
return false |
|
|
@ -589,12 +589,12 @@ does any email provider accept all posibilities. |
|
|
|
|
|
|
|
|
|
|
|
File path |
|
|
|
File path |
|
|
|
|
|
|
|
|
|
|
|
This validates that a string value contains a valid file path and that
|
|
|
|
This validates that a string value contains a valid file path and that |
|
|
|
the file exists on the machine.
|
|
|
|
the file exists on the machine. |
|
|
|
This is done using os.Stat, which is a platform independent function.
|
|
|
|
This is done using os.Stat, which is a platform independent function. |
|
|
|
|
|
|
|
|
|
|
|
Usage: file |
|
|
|
Usage: file |
|
|
|
|
|
|
|
|
|
|
|
URL String |
|
|
|
URL String |
|
|
|
|
|
|
|
|
|
|
|
This validates that a string value contains a valid url |
|
|
|
This validates that a string value contains a valid url |
|
|
|