validation

package
v0.17.8 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorTranslator added in v0.16.0

type ErrorTranslator interface {
	// Tag returns the identifier of the tag this translator is for.
	Tag() string
	// MessageTemplate returns a template for error translation
	MessageTemplate() string
	// ErrorMessage provides an error message for the given param.
	ErrorMessage(param string) string
}

type Option added in v0.16.0

type Option interface {
	// contains filtered or unexported methods
}

func WithErrorTranslator added in v0.16.0

func WithErrorTranslator(et ErrorTranslator) Option

func WithTagValidator added in v0.16.0

func WithTagValidator(tv TagValidator) Option

type TagValidator added in v0.16.0

type TagValidator interface {
	// Tag returns the identifier of the custom validator.
	Tag() string
	// Validate implements the actual validation logic.
	Validate(param string, field reflect.Value) bool
	// AlwaysValidate informs that the Validate function
	// should always be called, even if the field is not set
	AlwaysValidate() bool
}

type Validator added in v0.16.0

type Validator interface {
	ValidateStruct(s any) error
}

func NewValidator added in v0.16.0

func NewValidator(opts ...Option) (Validator, error)

Jump to

Keyboard shortcuts

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