validate

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZH = `zh` // 中文
	EN = `en` // 英文
)

Variables

View Source
var (
	Validator = validator.New()
)

Functions

func RegisterCustom

func RegisterCustom(custom *Custom)

func Struct

func Struct(s interface{}) error

Struct 验证结构体

func TransError

func TransError(err error, locale ...string) error

TransError 翻译错误信息

Types

type Custom

type Custom struct {
	Name    string         // 验证标签名
	Func    validator.Func // 验证方法
	Chinese string         // 中文信息
	English string         // 英文信息
}

Custom 自定义验证器

Jump to

Keyboard shortcuts

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