validator

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalValidatorMapping = make(map[string]*MyValidator, 0)

GlobalValidatorMapping is a mapping from validator to translator used

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check() (errField []*FormErrorField, err error)
}

Checker .

type FormErrorField added in v0.4.0

type FormErrorField struct {
	ErrorField string `json:"error_field"`
	ErrorMsg   string `json:"error_msg"`
}

FormErrorField indicates the current form error content. which field is error and error message.

type MyValidator

type MyValidator struct {
	Validate *validator.Validate
	Tran     ut.Translator
	Lang     i18n.Language
}

MyValidator my validator

func GetValidatorByLang

func GetValidatorByLang(la string) *MyValidator

func (*MyValidator) Check

func (m *MyValidator) Check(value interface{}) (errFields []*FormErrorField, err error)

Check /

Jump to

Keyboard shortcuts

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