From 110c8638eb0e0fa61f1d9417aa53bc2bdaefd65c Mon Sep 17 00:00:00 2001 From: Dean Karn Date: Thu, 15 Sep 2016 15:31:31 -0400 Subject: [PATCH] add good documentation --- doc.go | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/doc.go b/doc.go index dfc2a47..84bba94 100644 --- a/doc.go +++ b/doc.go @@ -5,21 +5,7 @@ based on tags. 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. -Why not a better error message? -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" - } - +see more examples https://github.com/go-playground/validator/tree/v9/examples Validation Functions Return Type error