validators

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetOrInitValidatorRules

func GetOrInitValidatorRules[V Validator[T], T any]() []validate.FieldRule[T]

func GetOrInitValidatorRulesFromStore

func GetOrInitValidatorRulesFromStore[V Validator[T], T any](store ValidatorStore) []validate.FieldRule[T]

func GetValidatorRules

func GetValidatorRules[V Validator[T], T any]() []validate.FieldRule[T]

func GetValidatorRulesFromStore

func GetValidatorRulesFromStore[V Validator[T], T any](store ValidatorStore) []validate.FieldRule[T]

func InitValidatorInStore

func InitValidatorInStore[V Validator[T], T any](
	store ValidatorStore,
	validator V,
)

InitValidatorInStore init validator into store

func InitValidatorRules

func InitValidatorRules[V Validator[T], T any](validator V)

func NewConcurrentMapStore

func NewConcurrentMapStore() *concurrentMapStore

Types

type Validator

type Validator[T any] interface {
	Name() string
	Rules() []validate.FieldRule[T]
}

func Wrap

func Wrap[V Validator[T], T any](validator V) Validator[T]

type ValidatorStore

type ValidatorStore interface {
	Get(key string) any
	Set(key string, v any)
}

func GlobalMapStore

func GlobalMapStore() ValidatorStore

func NewDefaultMapStore

func NewDefaultMapStore() ValidatorStore

NewDefaultMapStore return default map store it's not for concurrent write

type ValidatorWrapper

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

func (*ValidatorWrapper[T]) Rules

func (v *ValidatorWrapper[T]) Rules() []validate.FieldRule[T]

Jump to

Keyboard shortcuts

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