vldz

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRegisterValidator

func MustRegisterValidator(tag string, validator validator.Func)

MustRegisterValidator registers a validator.

func MustValidateStruct

func MustValidateStruct(v any)

MustValidateStruct is like ValidateStruct but panics on error.

func RegexpValidatorFactory

func RegexpValidatorFactory(regexp *regexp.Regexp) validator.Func

RegexpValidatorFactory creates a validator that matches a string against the given regexp.

func ValidateStruct

func ValidateStruct(v any) error

ValidateStruct validates a struct.

Types

type ValidationError

type ValidationError struct {
	// contains filtered or unexported fields
}

ValidationError describes a validation error.

func NewValidationError

func NewValidationError(err error) *ValidationError

NewValidationError initializes a new validation error.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error implements the error interface.

func (*ValidationError) MaybeGetFieldsSummary

func (e *ValidationError) MaybeGetFieldsSummary() map[string]any

MaybeGetFieldsSummary returns the fields summary if available.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap implements the errorz.UnwrapSingle interface.

Jump to

Keyboard shortcuts

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