validators

package
v0.0.2-rc2 Latest Latest
Warning

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

Go to latest
Published: May 12, 2025 License: MIT Imports: 2 Imported by: 0

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