valid

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooLow        = errors.NewFrozenError("TOO_LOW", "Value is too low", 400)
	ErrTooHigh       = errors.NewFrozenError("TOO_HIGH", "Value is too high", 400)
	ErrTooShort      = errors.NewFrozenError("TOO_SHORT", "Value is too short", 400)
	ErrTooLong       = errors.NewFrozenError("TOO_LONG", "Value is too long", 400)
	ErrRequired      = errors.NewFrozenError("REQUIRED", "Value is required", 400)
	ErrFailedEnum    = errors.NewFrozenError("FAILED_ENUM", "Value is too low", 400)
	ErrFailedPattern = errors.NewFrozenError("FAILED_PATTERN", "Value does not match pattern", 400)
)

Functions

This section is empty.

Types

type StructValidator

type StructValidator[T any] func(ptr *T, errs *errors.Errors) bool

Validates T and returns a boolean whether it's valid

func CreateStructValidator

func CreateStructValidator[T any]() (StructValidator[T], error)

Create a validator that can be reused for a specific struct type.

Jump to

Keyboard shortcuts

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