修改包路径

This commit is contained in:
gamife 2020-11-28 14:54:02 +08:00
parent 9c24964dcd
commit bdb38001a2
39 changed files with 110 additions and 105 deletions

View File

@ -9,7 +9,7 @@ import (
"io" "io"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
) )
type translation struct { type translation struct {

View File

@ -5,7 +5,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
) )
const ( const (

View File

@ -3,7 +3,7 @@ package ut
import ( import (
"strings" "strings"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
) )
// UniversalTranslator holds all locale & translation data // UniversalTranslator holds all locale & translation data

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// MyStruct .. // MyStruct ..

View File

@ -6,7 +6,7 @@ import (
"fmt" "fmt"
"reflect" "reflect"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// DbBackedUser User struct // DbBackedUser User struct

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// Test ... // Test ...

View File

@ -4,8 +4,8 @@ import (
"reflect" "reflect"
"sync" "sync"
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
"github.com/go-playground/validator/v10"
) )
type defaultValidator struct { type defaultValidator struct {

View File

@ -3,7 +3,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// User contains user information // User contains user information

View File

@ -5,7 +5,7 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// User contains user information // User contains user information

View File

@ -3,10 +3,10 @@ package main
import ( import (
"fmt" "fmt"
"github.com/go-playground/locales/en" "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
en_translations "github.com/go-playground/validator/v10/translations/en" en_translations "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10/translations/en"
) )
// User contains user information // User contains user information

View File

@ -6,7 +6,7 @@ import (
"reflect" "reflect"
"strings" "strings"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
) )
const ( const (

View File

@ -4,7 +4,7 @@ import (
"reflect" "reflect"
"strings" "strings"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// NotBlank is the validation function for validating if the current field // NotBlank is the validation function for validating if the current field

View File

@ -3,8 +3,8 @@ package validators
import ( import (
"testing" "testing"
"github.com/go-playground/assert/v2" "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
type test struct { type test struct {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
english "github.com/go-playground/locales/en" english "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
spanish "github.com/go-playground/locales/es" spanish "git.ningdatech.com/ningda/gin_valid/go-playground/locales/es"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
french "github.com/go-playground/locales/fr" french "git.ningdatech.com/ningda/gin_valid/go-playground/locales/fr"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
indonesia "github.com/go-playground/locales/id" indonesia "git.ningdatech.com/ningda/gin_valid/go-playground/locales/id"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
ja_locale "github.com/go-playground/locales/ja" ja_locale "git.ningdatech.com/ningda/gin_valid/go-playground/locales/ja"
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
ut "github.com/go-playground/universal-translator" ut "github.com/go-playground/universal-translator"
"github.com/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
english "github.com/go-playground/locales/en" english "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,11 +4,11 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
"github.com/go-playground/locales/pt" "git.ningdatech.com/ningda/gin_valid/go-playground/locales/pt"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
brazilian_portuguese "github.com/go-playground/locales/pt_BR" brazilian_portuguese "git.ningdatech.com/ningda/gin_valid/go-playground/locales/pt_BR"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -6,10 +6,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
russian "github.com/go-playground/locales/en" russian "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
turkish "github.com/go-playground/locales/tr" turkish "git.ningdatech.com/ningda/gin_valid/go-playground/locales/tr"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -2,15 +2,15 @@ package zh
import ( import (
"fmt" "fmt"
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
"log" "log"
"reflect" "reflect"
"strconv" "strconv"
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
zhongwen "github.com/go-playground/locales/zh" zhongwen "git.ningdatech.com/ningda/gin_valid/go-playground/locales/zh"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -8,9 +8,9 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-playground/locales" "git.ningdatech.com/ningda/gin_valid/go-playground/locales"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
// RegisterDefaultTranslations registers a set of default translations // RegisterDefaultTranslations registers a set of default translations

View File

@ -4,10 +4,10 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
zhongwen "github.com/go-playground/locales/zh_Hant_TW" zhongwen "git.ningdatech.com/ningda/gin_valid/go-playground/locales/zh_Hant_TW"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
"github.com/go-playground/validator/v10" "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
) )
func TestTranslations(t *testing.T) { func TestTranslations(t *testing.T) {

View File

@ -14,11 +14,11 @@ import (
"testing" "testing"
"time" "time"
. "github.com/go-playground/assert/v2" . "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
"github.com/go-playground/locales/en" "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
"github.com/go-playground/locales/fr" "git.ningdatech.com/ningda/gin_valid/go-playground/locales/fr"
"github.com/go-playground/locales/nl" "git.ningdatech.com/ningda/gin_valid/go-playground/locales/nl"
ut "github.com/go-playground/universal-translator" ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
) )
// NOTES: // NOTES:

5
go.mod
View File

@ -3,9 +3,14 @@ module git.ningdatech.com/ningda/gin_valid
go 1.13 go 1.13
require ( require (
github.com/gin-gonic/gin v1.6.3 // indirect
github.com/go-playground/universal-translator v0.17.0
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/golang/protobuf v1.4.3 github.com/golang/protobuf v1.4.3
github.com/json-iterator/go v1.1.10 // indirect github.com/json-iterator/go v1.1.10 // indirect
github.com/leodido/go-urn v1.2.0
github.com/ugorji/go v1.2.0 // indirect github.com/ugorji/go v1.2.0 // indirect
github.com/ugorji/go/codec v1.2.0 github.com/ugorji/go/codec v1.2.0
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v2 v2.4.0
) )