validator

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 36 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

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

func Sanitizer

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

Types

type Checker

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

Checker .

type FormErrorField

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

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