validator

package
v0.0.0-...-91ba331 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Between

func Between[T cmp.Ordered](t, min, max T, name string) error

func Contains

func Contains[T comparable, S ~[]T](t T, s S, name string) error

func EqualWith

func EqualWith[T comparable](t, want T, name string) error

func GreaterOrEqual

func GreaterOrEqual[T cmp.Ordered](t, bound T, name string) error

func GreaterThan

func GreaterThan[T cmp.Ordered](t, bound T, name string) error

func Implements

func Implements[T any](v any, name string) error

Implements checks that v can be asserted to T. T is typically an interface type — when T is a concrete type the check degenerates to dynamic-type equality.

func LessOrEqual

func LessOrEqual[T cmp.Ordered](t, bound T, name string) error

func LessThan

func LessThan[T cmp.Ordered](t, bound T, name string) error

func MaxRune

func MaxRune[T ~string](s T, n int, name string) error

func MinRune

func MinRune[T ~string](s T, n int, name string) error

func NonEmpty

func NonEmpty[T comparable](t T, name string) error

func NonEmptyMap

func NonEmptyMap[M ~map[K]V, K comparable, V any](m M, name string) error

func NonEmptySlice

func NonEmptySlice[S ~[]E, E any](s S, name string) error

func NotContains

func NotContains[T comparable, S ~[]T](t T, s S, name string) error

func NotEqualWith

func NotEqualWith[T comparable](t, banned T, name string) error

func NotNil

func NotNil[T any](t *T, name string) error

func StringContains

func StringContains[T ~string](s T, substr, name string) error

func StringEndsWith

func StringEndsWith[T ~string](s T, suffix, name string) error

func StringStartsWith

func StringStartsWith[T ~string](s T, prefix, name string) error

Types

type ValidError

type ValidError struct {
	Field string
	Value any
	// contains filtered or unexported fields
}

func NewValidError

func NewValidError(field string, value any, err error) *ValidError

func (*ValidError) Error

func (v *ValidError) Error() string

func (*ValidError) Unwrap

func (v *ValidError) Unwrap() error

Jump to

Keyboard shortcuts

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