修改包路径
This commit is contained in:
parent
9c24964dcd
commit
bdb38001a2
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
"io"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||
)
|
||||
|
||||
type translation struct {
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -3,7 +3,7 @@ package ut
|
|||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||
)
|
||||
|
||||
// UniversalTranslator holds all locale & translation data
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// MyStruct ..
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"fmt"
|
||||
"reflect"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// DbBackedUser User struct
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// Test ...
|
||||
|
|
|
@ -4,8 +4,8 @@ import (
|
|||
"reflect"
|
||||
"sync"
|
||||
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type defaultValidator struct {
|
||||
|
|
|
@ -3,7 +3,7 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// User contains user information
|
||||
|
|
|
@ -5,7 +5,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
// User contains user information
|
||||
|
|
|
@ -3,10 +3,10 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
en_translations "github.com/go-playground/validator/v10/translations/en"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
en_translations "git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10/translations/en"
|
||||
)
|
||||
|
||||
// User contains user information
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
"reflect"
|
||||
"strings"
|
||||
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"reflect"
|
||||
"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
|
||||
|
|
|
@ -3,8 +3,8 @@ package validators
|
|||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-playground/assert/v2"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
type test struct {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
english "github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
english "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
spanish "github.com/go-playground/locales/es"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
spanish "git.ningdatech.com/ningda/gin_valid/go-playground/locales/es"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
french "github.com/go-playground/locales/fr"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
french "git.ningdatech.com/ningda/gin_valid/go-playground/locales/fr"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
indonesia "github.com/go-playground/locales/id"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
indonesia "git.ningdatech.com/ningda/gin_valid/go-playground/locales/id"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
ja_locale "github.com/go-playground/locales/ja"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
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"
|
||||
"github.com/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
english "github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
english "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,11 +4,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
"github.com/go-playground/locales/pt"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/pt"
|
||||
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) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
brazilian_portuguese "github.com/go-playground/locales/pt_BR"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
brazilian_portuguese "git.ningdatech.com/ningda/gin_valid/go-playground/locales/pt_BR"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -6,10 +6,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
russian "github.com/go-playground/locales/en"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
russian "git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
turkish "github.com/go-playground/locales/tr"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
turkish "git.ningdatech.com/ningda/gin_valid/go-playground/locales/tr"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -2,15 +2,15 @@ package zh
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
"log"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
zhongwen "github.com/go-playground/locales/zh"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
zhongwen "git.ningdatech.com/ningda/gin_valid/go-playground/locales/zh"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -8,9 +8,9 @@ import (
|
|||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/go-playground/locales"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
"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"
|
||||
)
|
||||
|
||||
// RegisterDefaultTranslations registers a set of default translations
|
||||
|
|
|
@ -4,10 +4,10 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
zhongwen "github.com/go-playground/locales/zh_Hant_TW"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
"github.com/go-playground/validator/v10"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
zhongwen "git.ningdatech.com/ningda/gin_valid/go-playground/locales/zh_Hant_TW"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/validator/v10"
|
||||
)
|
||||
|
||||
func TestTranslations(t *testing.T) {
|
||||
|
|
|
@ -14,11 +14,11 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
. "github.com/go-playground/assert/v2"
|
||||
"github.com/go-playground/locales/en"
|
||||
"github.com/go-playground/locales/fr"
|
||||
"github.com/go-playground/locales/nl"
|
||||
ut "github.com/go-playground/universal-translator"
|
||||
. "git.ningdatech.com/ningda/gin_valid/go-playground/assert/v2"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/en"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/fr"
|
||||
"git.ningdatech.com/ningda/gin_valid/go-playground/locales/nl"
|
||||
ut "git.ningdatech.com/ningda/gin_valid/go-playground/universal-translator"
|
||||
)
|
||||
|
||||
// NOTES:
|
||||
|
|
5
go.mod
5
go.mod
|
@ -3,9 +3,14 @@ module git.ningdatech.com/ningda/gin_valid
|
|||
go 1.13
|
||||
|
||||
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/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/codec v1.2.0
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue