vldz

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package vldz provides various utilities for validating data.

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(r *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) GetErrorDetails added in v0.13.0

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

GetErrorDetails implements the errorz.ErrorDetails interface.

func (*ValidationError) GetErrorName added in v0.13.0

func (*ValidationError) GetErrorName() string

GetErrorName implements the errorz.ErrorName interface.

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