validation

package
v0.54.6 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupDefault = "default"
)

Variables

This section is empty.

Functions

func IsValidationError added in v0.40.3

func IsValidationError(err error) bool

func NewValidator

func NewValidator(ctx context.Context, config cfg.Config, logger log.Logger) (*validator, error)

func NewValidatorWithInterfaces

func NewValidatorWithInterfaces(tracer tracing.Tracer) *validator

Types

type Error

type Error struct {
	Errors []error
}

func NewError added in v0.40.3

func NewError(errs ...error) *Error

func (*Error) As

func (e *Error) As(target any) bool

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(err error) bool

type Group

type Group map[string][]Rule

type Rule

type Rule interface {
	IsValid(ctx context.Context, model any) error
}

type Validator

type Validator interface {
	AddRule(rule Rule, groups ...string)
	IsValid(ctx context.Context, model any, groups ...string) error
}

Jump to

Keyboard shortcuts

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