validation

package
v0.69.5 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 7 Imported by: 3 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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