Documentation ¶
Index ¶
- func NewValidation(options ...ValidationOption) validator.Validation
- func NewValidationTranslation(translator locales.Translator, register func(translator ut.Translator) error) validator.ValidationTranslation
- type TranslationOption
- type ValidationOption
- func WithCustomFieldValidator(tagName string, fn func(fl v10.FieldLevel) bool) ValidationOption
- func WithCustomStructValidator(validationName string, fn func(fl v10.StructLevel)) ValidationOption
- func WithTranslation(translation TranslationOption) ValidationOption
- func WithTranslations(translations ...TranslationOption) ValidationOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewValidation ¶
func NewValidation(options ...ValidationOption) validator.Validation
NewValidation function to initialize Validation.
func NewValidationTranslation ¶
func NewValidationTranslation( translator locales.Translator, register func(translator ut.Translator) error, ) validator.ValidationTranslation
NewValidationTranslation function to initialize ValidationTranslation interface.
Types ¶
type TranslationOption ¶ added in v1.0.1
type TranslationOption struct { Translator locales.Translator Register func(v *v10.Validate, translator ut.Translator) error }
type ValidationOption ¶ added in v1.0.1
type ValidationOption interface {
Apply(options *validationOptions)
}
func WithCustomFieldValidator ¶ added in v1.0.1
func WithCustomFieldValidator(tagName string, fn func(fl v10.FieldLevel) bool) ValidationOption
WithCustomFieldValidator function for add custom field validator ValidationOption.
func WithCustomStructValidator ¶ added in v1.0.1
func WithCustomStructValidator(validationName string, fn func(fl v10.StructLevel)) ValidationOption
WithCustomStructValidator function for add custom struct validator ValidationOption.
func WithTranslation ¶ added in v1.0.1
func WithTranslation(translation TranslationOption) ValidationOption
WithTranslation function for add new translation ValidationOption.
func WithTranslations ¶ added in v1.0.1
func WithTranslations(translations ...TranslationOption) ValidationOption
WithTranslations function for add multiple new translation ValidationOption.
Click to show internal directories.
Click to hide internal directories.