xvalidate

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MulanPSL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrConvertMapStringSlice can not covert to map[string][]string
	ErrConvertMapStringSlice = errors.New("can not convert to map slices of strings")

	// ErrConvertToMapString can not convert to map[string]string
	ErrConvertToMapString = errors.New("can not convert to map of strings")
)

Functions

func ITranslator

func ITranslator(v *validator.Validate, trans ut.Translator)

======================================================================================== * * 功能:自定义翻译器 * 描述:这里编写自定义的规则 * 参考:https://github.com/go-playground/validator/blob/v9/_examples/translations/main.go * ========================================================================================

func IValidateRule

func IValidateRule(v *validator.Validate)

====================================================================== * * 功能:自定义验证规则 * 描述:这里编写自定义的规则 * ======================================================================

func MapFormWithTag

func MapFormWithTag(ptr any, form map[string][]string, tag string) error

func ValidateParam

func ValidateParam(ctx *gin.Context, param interface{}) error

====================================================================== * * 功能:验证参数 和 报错信息 本地化翻译 * ======================================================================

Types

type IForm

type IForm struct {
}

func (IForm) Bind

func (t IForm) Bind(req *http.Request, obj interface{}) error

解析请求,绑定数据对象 i=ComIdReq

func (IForm) Name

func (t IForm) Name() string

Jump to

Keyboard shortcuts

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