validator

package
v1.0.32 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNumberIsInvalid = errorer.New("number")
View Source
var ErrStringIsInvalid = errors.New("string")

Functions

func StringMatches

func StringMatches[T ~string](regex string) func(s T) error

func StringMax

func StringMax[T ~string](max int) func(s T) error

func StringMin

func StringMin[T ~string](min int) func(s T) error

func StringNotEmpty

func StringNotEmpty[T ~string]() func(s T) error

Types

type SliceValidator

type SliceValidator[T any] struct {
	// contains filtered or unexported fields
}

type StringValidatorBuilder

type StringValidatorBuilder[T ~string] struct {
	// contains filtered or unexported fields
}

func String

func String[T ~string]() *StringValidatorBuilder[T]

func (*StringValidatorBuilder[T]) Matches

func (t *StringValidatorBuilder[T]) Matches(regex string) *StringValidatorBuilder[T]

func (*StringValidatorBuilder[T]) Max

func (*StringValidatorBuilder[T]) Min

func (*StringValidatorBuilder[T]) NotZero

func (t *StringValidatorBuilder[T]) NotZero() *StringValidatorBuilder[T]

func (*StringValidatorBuilder[T]) Validate

func (t *StringValidatorBuilder[T]) Validate(item T, groups ...string) error

type Validatable added in v1.0.28

type Validatable interface {
	Validate(groups ...string) error
	Groups() []string
}

type Validator added in v1.0.28

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

func NewValidator added in v1.0.28

func NewValidator() *Validator

func (Validator) Validate added in v1.0.28

func (t Validator) Validate(groups ...string) error

Jump to

Keyboard shortcuts

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