From f956bce255b692af9f27ce499a39efeee0674af4 Mon Sep 17 00:00:00 2001 From: wangjian Date: Wed, 4 Jan 2023 22:25:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=85=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go-playground/locales/rules.go | 2 +- go-playground/locales/zh/zh.go | 4 +-- go-playground/universal-translator/errors.go | 2 +- .../universal-translator/import_export.go | 2 +- go-playground/universal-translator/translator.go | 2 +- .../universal-translator/universal_translator.go | 2 +- go-playground/validator/v10/README.md | 4 +-- go-playground/validator/v10/errors.go | 32 +++++++++++----------- .../v10/non-standard/validators/notblank.go | 2 +- .../v10/non-standard/validators/notblank_test.go | 2 +- go-playground/validator/v10/translations.go | 2 +- go-playground/validator/v10/translations/en/en.go | 6 ++-- go-playground/validator/v10/translations/es/es.go | 6 ++-- go-playground/validator/v10/translations/fr/fr.go | 6 ++-- go-playground/validator/v10/translations/id/id.go | 6 ++-- go-playground/validator/v10/translations/ja/ja.go | 6 ++-- go-playground/validator/v10/translations/nl/nl.go | 6 ++-- go-playground/validator/v10/translations/pt/pt.go | 6 ++-- .../validator/v10/translations/pt_BR/pt_BR.go | 6 ++-- go-playground/validator/v10/translations/ru/ru.go | 6 ++-- go-playground/validator/v10/translations/tr/tr.go | 6 ++-- go-playground/validator/v10/translations/zh/zh.go | 6 ++-- .../validator/v10/translations/zh_tw/zh_tw.go | 6 ++-- go-playground/validator/v10/validator_instance.go | 16 +++++------ 24 files changed, 72 insertions(+), 72 deletions(-) diff --git a/go-playground/locales/rules.go b/go-playground/locales/rules.go index 6fd1b93..bda1f32 100644 --- a/go-playground/locales/rules.go +++ b/go-playground/locales/rules.go @@ -4,7 +4,7 @@ import ( "strconv" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales/currency" + "git.hpds.cc/Component/gin_valid/go-playground/locales/currency" ) // // ErrBadNumberValue is returned when the number passed for diff --git a/go-playground/locales/zh/zh.go b/go-playground/locales/zh/zh.go index 9672a78..fd69afd 100644 --- a/go-playground/locales/zh/zh.go +++ b/go-playground/locales/zh/zh.go @@ -5,8 +5,8 @@ import ( "strconv" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales/currency" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + "git.hpds.cc/Component/gin_valid/go-playground/locales/currency" ) type zh struct { diff --git a/go-playground/universal-translator/errors.go b/go-playground/universal-translator/errors.go index af6510e..6879c8b 100644 --- a/go-playground/universal-translator/errors.go +++ b/go-playground/universal-translator/errors.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" + "git.hpds.cc/Component/gin_valid/go-playground/locales" ) var ( diff --git a/go-playground/universal-translator/import_export.go b/go-playground/universal-translator/import_export.go index 7cec0d0..4623de9 100644 --- a/go-playground/universal-translator/import_export.go +++ b/go-playground/universal-translator/import_export.go @@ -9,7 +9,7 @@ import ( "io" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" + "git.hpds.cc/Component/gin_valid/go-playground/locales" ) type translation struct { diff --git a/go-playground/universal-translator/translator.go b/go-playground/universal-translator/translator.go index 1d89cf9..dee2dea 100644 --- a/go-playground/universal-translator/translator.go +++ b/go-playground/universal-translator/translator.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" + "git.hpds.cc/Component/gin_valid/go-playground/locales" ) const ( diff --git a/go-playground/universal-translator/universal_translator.go b/go-playground/universal-translator/universal_translator.go index 6292194..e968779 100644 --- a/go-playground/universal-translator/universal_translator.go +++ b/go-playground/universal-translator/universal_translator.go @@ -3,7 +3,7 @@ package ut import ( "strings" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" + "git.hpds.cc/Component/gin_valid/go-playground/locales" ) // UniversalTranslator holds all locale & translation data diff --git a/go-playground/validator/v10/README.md b/go-playground/validator/v10/README.md index 5d0cb92..7cfac5a 100644 --- a/go-playground/validator/v10/README.md +++ b/go-playground/validator/v10/README.md @@ -27,11 +27,11 @@ Installation Use go get. - go get git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10 + go get git.hpds.cc/Component/gin_valid/go-playground/validator/v10 Then import the validator package into your own code. - import "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + import "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" Error Return Value ------- diff --git a/go-playground/validator/v10/errors.go b/go-playground/validator/v10/errors.go index cf89f46..6614e8f 100644 --- a/go-playground/validator/v10/errors.go +++ b/go-playground/validator/v10/errors.go @@ -6,7 +6,7 @@ import ( "reflect" "strings" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" ) const ( @@ -58,27 +58,27 @@ func (ve ValidationErrors) Error() string { // yang 修改 // Translate translates all of the ValidationErrors -//func (ve ValidationErrors) Translate(ut ut.Translator) ValidationErrorsTranslations { +// func (ve ValidationErrors) Translate(ut ut.Translator) ValidationErrorsTranslations { // -// trans := make(ValidationErrorsTranslations) +// trans := make(ValidationErrorsTranslations) // -// var fe *fieldError +// var fe *fieldError // -// for i := 0; i < len(ve); i++ { -// fe = ve[i].(*fieldError) +// for i := 0; i < len(ve); i++ { +// fe = ve[i].(*fieldError) // -// // // in case an Anonymous struct was used, ensure that the key -// // // would be 'Username' instead of ".Username" -// // if len(fe.ns) > 0 && fe.ns[:1] == "." { -// // trans[fe.ns[1:]] = fe.Translate(ut) -// // continue -// // } +// // // in case an Anonymous struct was used, ensure that the key +// // // would be 'Username' instead of ".Username" +// // if len(fe.ns) > 0 && fe.ns[:1] == "." { +// // trans[fe.ns[1:]] = fe.Translate(ut) +// // continue +// // } // -// trans[fe.ns] = fe.Translate(ut) +// trans[fe.ns] = fe.Translate(ut) +// } +// +// return trans // } -// -// return trans -//} type TransValidError struct { ErrorString string } diff --git a/go-playground/validator/v10/non-standard/validators/notblank.go b/go-playground/validator/v10/non-standard/validators/notblank.go index 1440a20..df5abb6 100644 --- a/go-playground/validator/v10/non-standard/validators/notblank.go +++ b/go-playground/validator/v10/non-standard/validators/notblank.go @@ -1,7 +1,7 @@ package validators import ( - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" "reflect" "strings" ) diff --git a/go-playground/validator/v10/non-standard/validators/notblank_test.go b/go-playground/validator/v10/non-standard/validators/notblank_test.go index 4c739bb..e983b14 100644 --- a/go-playground/validator/v10/non-standard/validators/notblank_test.go +++ b/go-playground/validator/v10/non-standard/validators/notblank_test.go @@ -1,7 +1,7 @@ package validators import ( - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" "github.com/go-playground/assert/v2" "testing" ) diff --git a/go-playground/validator/v10/translations.go b/go-playground/validator/v10/translations.go index ea58a85..f4e4afa 100644 --- a/go-playground/validator/v10/translations.go +++ b/go-playground/validator/v10/translations.go @@ -1,6 +1,6 @@ package validator -import ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" +import ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" // TranslationFunc is the function type used to register or override // custom translations diff --git a/go-playground/validator/v10/translations/en/en.go b/go-playground/validator/v10/translations/en/en.go index 1ab53e1..194caf5 100644 --- a/go-playground/validator/v10/translations/en/en.go +++ b/go-playground/validator/v10/translations/en/en.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/es/es.go b/go-playground/validator/v10/translations/es/es.go index 8df35ad..a8e0543 100644 --- a/go-playground/validator/v10/translations/es/es.go +++ b/go-playground/validator/v10/translations/es/es.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/fr/fr.go b/go-playground/validator/v10/translations/fr/fr.go index b27c588..62ff2ee 100644 --- a/go-playground/validator/v10/translations/fr/fr.go +++ b/go-playground/validator/v10/translations/fr/fr.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/id/id.go b/go-playground/validator/v10/translations/id/id.go index 594e8c1..4c8a860 100644 --- a/go-playground/validator/v10/translations/id/id.go +++ b/go-playground/validator/v10/translations/id/id.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/ja/ja.go b/go-playground/validator/v10/translations/ja/ja.go index 26c9367..e436f22 100644 --- a/go-playground/validator/v10/translations/ja/ja.go +++ b/go-playground/validator/v10/translations/ja/ja.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/nl/nl.go b/go-playground/validator/v10/translations/nl/nl.go index 8f49a1d..2abc627 100644 --- a/go-playground/validator/v10/translations/nl/nl.go +++ b/go-playground/validator/v10/translations/nl/nl.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/pt/pt.go b/go-playground/validator/v10/translations/pt/pt.go index 91399a7..e9bfd77 100644 --- a/go-playground/validator/v10/translations/pt/pt.go +++ b/go-playground/validator/v10/translations/pt/pt.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/pt_BR/pt_BR.go b/go-playground/validator/v10/translations/pt_BR/pt_BR.go index 7f0e0aa..703a4be 100644 --- a/go-playground/validator/v10/translations/pt_BR/pt_BR.go +++ b/go-playground/validator/v10/translations/pt_BR/pt_BR.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/ru/ru.go b/go-playground/validator/v10/translations/ru/ru.go index 54ea05d..ea4374e 100644 --- a/go-playground/validator/v10/translations/ru/ru.go +++ b/go-playground/validator/v10/translations/ru/ru.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/tr/tr.go b/go-playground/validator/v10/translations/tr/tr.go index 2c3d773..98f2513 100644 --- a/go-playground/validator/v10/translations/tr/tr.go +++ b/go-playground/validator/v10/translations/tr/tr.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/zh/zh.go b/go-playground/validator/v10/translations/zh/zh.go index 42b52b5..7d4867a 100644 --- a/go-playground/validator/v10/translations/zh/zh.go +++ b/go-playground/validator/v10/translations/zh/zh.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/translations/zh_tw/zh_tw.go b/go-playground/validator/v10/translations/zh_tw/zh_tw.go index 40dd9f5..1b92efe 100644 --- a/go-playground/validator/v10/translations/zh_tw/zh_tw.go +++ b/go-playground/validator/v10/translations/zh_tw/zh_tw.go @@ -8,9 +8,9 @@ import ( "strings" "time" - "git.ningdatech.com/ningda/gin_valid/go-playground/locales" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" - "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10" + "git.hpds.cc/Component/gin_valid/go-playground/locales" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" + "git.hpds.cc/Component/gin_valid/go-playground/validator/v10" ) // RegisterDefaultTranslations registers a set of default translations diff --git a/go-playground/validator/v10/validator_instance.go b/go-playground/validator/v10/validator_instance.go index bbe7a4f..7fd2d04 100644 --- a/go-playground/validator/v10/validator_instance.go +++ b/go-playground/validator/v10/validator_instance.go @@ -9,7 +9,7 @@ import ( "sync" "time" - ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator" + ut "git.hpds.cc/Component/gin_valid/go-playground/universal-translator" ) const ( @@ -142,13 +142,13 @@ func (v *Validate) SetTagName(name string) { // // eg. to use the names which have been specified for JSON representations of structs, rather than normal Go field names: // -// validate.RegisterTagNameFunc(func(fld reflect.StructField) string { -// name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0] -// if name == "-" { -// return "" -// } -// return name -// }) +// validate.RegisterTagNameFunc(func(fld reflect.StructField) string { +// name := strings.SplitN(fld.Tag.Get("json"), ",", 2)[0] +// if name == "-" { +// return "" +// } +// return name +// }) func (v *Validate) RegisterTagNameFunc(fn TagNameFunc) { v.tagNameFunc = fn v.hasTagNameFunc = true