Documentation ¶
Index ¶
- Variables
- func StringMatches[T ~string](regex string) func(s T) error
- func StringMax[T ~string](max int) func(s T) error
- func StringMin[T ~string](min int) func(s T) error
- func StringNotEmpty[T ~string]() func(s T) error
- type SliceValidator
- type StringValidatorBuilder
- func (t *StringValidatorBuilder[T]) Matches(regex string) *StringValidatorBuilder[T]
- func (t *StringValidatorBuilder[T]) Max(max int) *StringValidatorBuilder[T]
- func (t *StringValidatorBuilder[T]) Min(min int) *StringValidatorBuilder[T]
- func (t *StringValidatorBuilder[T]) NotZero() *StringValidatorBuilder[T]
- func (t *StringValidatorBuilder[T]) Validate(item T, groups ...string) error
- type Validatable
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNumberIsInvalid = errorer.New("number")
View Source
var ErrStringIsInvalid = errors.New("string")
Functions ¶
func StringMatches ¶
func StringNotEmpty ¶
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 (t *StringValidatorBuilder[T]) Max(max int) *StringValidatorBuilder[T]
func (*StringValidatorBuilder[T]) Min ¶
func (t *StringValidatorBuilder[T]) Min(min int) *StringValidatorBuilder[T]
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
Click to show internal directories.
Click to hide internal directories.