validation

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GroupDefault = "default"
)

Variables

This section is empty.

Functions

func NewOperationValidatingRepository

func NewOperationValidatingRepository(validator Validator, repo db_repo.Repository) db_repo.Repository

func NewRepository

func NewRepository(validator Validator, repo db_repo.Repository) db_repo.Repository

func NewValidator

func NewValidator(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 (*Error) As

func (e *Error) As(target interface{}) 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 OperationValidatingRepository

type OperationValidatingRepository struct {
	db_repo.Repository
	// contains filtered or unexported fields
}

func (OperationValidatingRepository) Create

func (r OperationValidatingRepository) Create(ctx context.Context, value db_repo.ModelBased) error

func (OperationValidatingRepository) Delete

func (r OperationValidatingRepository) Delete(ctx context.Context, value db_repo.ModelBased) error

func (OperationValidatingRepository) Update

func (r OperationValidatingRepository) Update(ctx context.Context, value db_repo.ModelBased) error

type Repository

type Repository struct {
	db_repo.Repository
	// contains filtered or unexported fields
}

func (Repository) Create

func (r Repository) Create(ctx context.Context, value db_repo.ModelBased) error

func (Repository) Update

func (r Repository) Update(ctx context.Context, value db_repo.ModelBased) error

type Rule

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

type Validator

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

Jump to

Keyboard shortcuts

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