xvalidator

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(locale string, register map[string]*Register) (err error)

初始化 验证器 以及 翻译器

func Struct

func Struct(data interface{}) error

数据验证

Types

type Register

type Register struct {
	Func func(validator.FieldLevel) bool
	Msg  string
}

type ValidationError

type ValidationError struct {
	ErrMsg []string `json:"err_msg"`
}

func GetMsg

func GetMsg(err error) *ValidationError

把数据验证错误,转为放回错误

func NewValidationError

func NewValidationError(errMap map[string]string) *ValidationError

func (*ValidationError) Error

func (r *ValidationError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL