Documentation ¶
Index ¶
- type Builder
- func (b *Builder) Build() (Validator, error)
- func (b *Builder) Validate(s interface{}) error
- func (b *Builder) WithFieldValidations(fieldValidations []FieldValidation) *Builder
- func (b *Builder) WithStructValidations(structValidations []StructValidation) *Builder
- func (b *Builder) WithTranslations(translations []Translation) *Builder
- type FieldError
- type FieldValidation
- type StructValidation
- type Translation
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is type to build validator
func (*Builder) WithFieldValidations ¶
func (b *Builder) WithFieldValidations(fieldValidations []FieldValidation) *Builder
WithFieldValidations tells builder to include custom field validation
func (*Builder) WithStructValidations ¶
func (b *Builder) WithStructValidations(structValidations []StructValidation) *Builder
WithStructValidations tells builder to include custom struct validation
func (*Builder) WithTranslations ¶
func (b *Builder) WithTranslations(translations []Translation) *Builder
WithTranslations tells builder to include custom translation
type FieldError ¶
FieldError is error with key is field name and value is all errors for that field
func (FieldError) Error ¶
func (d FieldError) Error() string
Error returns error that represent the field error
func (FieldError) JSON ¶
func (d FieldError) JSON() []byte
JSON converts field error into its JSON representation
type FieldValidation ¶
type FieldValidation struct { Tag string Func validator.Func }
FieldValidation is a type to describe how to validate a field
type StructValidation ¶
type StructValidation struct { Type interface{} Func validator.StructLevelFunc }
StructValidation is a type to describe how to validate a struct
type Translation ¶
type Translation struct { Tag string Message string Override bool TranslationFunc func(ut.Translator, validator.FieldError) string }
Translation is a type to describe how to translate
Click to show internal directories.
Click to hide internal directories.