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 ¶
Types ¶
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) }
Click to show internal directories.
Click to hide internal directories.