validator

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalValidatorMapping = make(map[i18n.Language]*MyValidator, 0)

GlobalValidatorMapping is a mapping from validator to translator used

Functions

func NotBlank added in v1.0.4

func NotBlank(fl validator.FieldLevel) (res bool)

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(lang i18n.Language) *MyValidator

func (*MyValidator) Check

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

Check /

type TranslatorLocal added in v1.0.1

type TranslatorLocal struct {
	La           i18n.Language
	Lo           locales.Translator
	RegisterFunc func(v *validator.Validate, trans ut.Translator) (err error)
}

Jump to

Keyboard shortcuts

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