validater

package
v1.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func NotOneOf

func NotOneOf[T constraints.Integer | constraints.Float](items ...T) func(s T) error

func NumberGreaterThan

func NumberGreaterThan[T constraints.Integer | constraints.Float](min T) func(s T) error

func NumberMax

func NumberMax[T constraints.Integer | constraints.Float](max T) func(s T) error

func NumberMin

func NumberMin[T constraints.Integer | constraints.Float](min T) func(s T) error

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 NumberValidatorBuilder

type NumberValidatorBuilder[T constraints.Integer | constraints.Float] struct {
	// contains filtered or unexported fields
}

func (*NumberValidatorBuilder[T]) Max

func (t *NumberValidatorBuilder[T]) Max(max T) *NumberValidatorBuilder[T]

func (*NumberValidatorBuilder[T]) Min

func (t *NumberValidatorBuilder[T]) Min(min T) *NumberValidatorBuilder[T]

func (*NumberValidatorBuilder[T]) NotOneOf

func (t *NumberValidatorBuilder[T]) NotOneOf(items ...T) *NumberValidatorBuilder[T]

func (*NumberValidatorBuilder[T]) Validator

func (t *NumberValidatorBuilder[T]) Validator(item T) Validater

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 Validater

type Validater interface {
	Validate(groups ...string) error
}

Jump to

Keyboard shortcuts

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