validator

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotValidValue    = errors.New("field is not valid")
	ErrNotValidPassword = errors.New("password is not valid")
	ErrUnknownTag       = errors.New("unknown tag value")
	ErrRequiredField    = errors.New("field required")
)

Functions

func Struct

func Struct(s any) error

Struct validates a struct based on the tags provided. It returns an error if the validation fails.

Types

type Field

type Field struct {
	Name  string
	Value reflect.Value
	Tags  []string
}

type ValidationErrors

type ValidationErrors struct {
	Errors []error
}

func (*ValidationErrors) Add

func (ve *ValidationErrors) Add(err error)

func (ValidationErrors) Error

func (ve ValidationErrors) Error() string

func (ValidationErrors) HasErrors

func (ve ValidationErrors) HasErrors() bool

func (ValidationErrors) UnWrap

func (ve ValidationErrors) UnWrap() []error

Jump to

Keyboard shortcuts

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