Skip to content

Commit 110c863

Browse files
Dean KarnDean Karn
authored andcommitted
add good documentation
1 parent 0e70fdf commit 110c863

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

doc.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,7 @@ based on tags.
55
It can also handle Cross-Field and Cross-Struct validation for nested structs
66
and has the ability to dive into arrays and maps of any type.
77
8-
Why not a better error message?
9-
Because this library intends for you to handle your own error messages.
10-
11-
Why should I handle my own errors?
12-
Many reasons. We built an internationalized application and needed to know the
13-
field, and what validation failed so we could provide a localized error.
14-
15-
if fieldErr.Field() == "Name" {
16-
switch fieldErr.Tag()
17-
case "required":
18-
return "Translated string based on field + error"
19-
default:
20-
return "Translated string based on field"
21-
}
22-
8+
see more examples https://github.com/go-playground/validator/tree/v9/examples
239
2410
Validation Functions Return Type error
2511

0 commit comments

Comments
 (0)