goPlaygroundV10

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2022 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

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.

Jump to

Keyboard shortcuts

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