add good documentation

pull/256/head
Dean Karn 8 years ago
parent 0e70fdfc72
commit 110c8638eb
  1. 16
      doc.go

@ -5,21 +5,7 @@ based on tags.
It can also handle Cross-Field and Cross-Struct validation for nested structs It can also handle Cross-Field and Cross-Struct validation for nested structs
and has the ability to dive into arrays and maps of any type. and has the ability to dive into arrays and maps of any type.
Why not a better error message? see more examples https://github.com/go-playground/validator/tree/v9/examples
Because this library intends for you to handle your own error messages.
Why should I handle my own errors?
Many reasons. We built an internationalized application and needed to know the
field, and what validation failed so we could provide a localized error.
if fieldErr.Field() == "Name" {
switch fieldErr.Tag()
case "required":
return "Translated string based on field + error"
default:
return "Translated string based on field"
}
Validation Functions Return Type error Validation Functions Return Type error

Loading…
Cancel
Save