Documentation
¶
Index ¶
- Variables
- func GetAny(name string) (any, bool)
- func ListValidators() []string
- func Register[T any](validator ZodValidator[T]) error
- func ToCheckFn[T any](validator ZodValidator[T], ctx *core.ParseContext) core.ZodCheckFn
- func ToCheckFnWithParam[T any](validator ZodParameterizedValidator[T], param string, ctx *core.ParseContext) core.ZodCheckFn
- func ToRefineFn[T any](validator ZodValidator[T]) core.ZodRefineFn[T]
- type ValidatorRegistry
- type ZodDetailedValidator
- type ZodParameterizedValidator
- type ZodValidator
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrValidatorAlreadyExists = errors.New("validator already exists")
)
Static error variables
Functions ¶
func ListValidators ¶
func ListValidators() []string
ListValidators returns all registered validator names
func Register ¶
func Register[T any](validator ZodValidator[T]) error
Register registers a validator instance by its name
func ToCheckFn ¶
func ToCheckFn[T any](validator ZodValidator[T], ctx *core.ParseContext) core.ZodCheckFn
ToCheckFn converts a ZodValidator to a ZodCheckFn for use with GoZod schemas
func ToCheckFnWithParam ¶
func ToCheckFnWithParam[T any](validator ZodParameterizedValidator[T], param string, ctx *core.ParseContext) core.ZodCheckFn
ToCheckFnWithParam converts a ZodParameterizedValidator to a ZodCheckFn with parameter
func ToRefineFn ¶
func ToRefineFn[T any](validator ZodValidator[T]) core.ZodRefineFn[T]
ToRefineFn converts a ZodValidator to a ZodRefineFn for use with GoZod schemas
Types ¶
type ValidatorRegistry ¶
type ValidatorRegistry struct {
// contains filtered or unexported fields
}
ValidatorRegistry manages registered validators
type ZodDetailedValidator ¶
type ZodDetailedValidator[T any] interface { ZodValidator[T] // ValidateDetail performs detailed validation with access to ParsePayload ValidateDetail(value T, payload *core.ParsePayload) }
ZodDetailedValidator extends ZodValidator for complex validation scenarios
type ZodParameterizedValidator ¶
type ZodParameterizedValidator[T any] interface { ZodValidator[T] // ValidateParam performs validation with a parameter ValidateParam(value T, param string) bool // ErrorMessageWithParam returns an error message with parameter context ErrorMessageWithParam(ctx *core.ParseContext, param string) string }
ZodParameterizedValidator extends ZodValidator to support parameters
type ZodValidator ¶
type ZodValidator[T any] interface { // Validate performs basic validation on the value Validate(value T) bool // Name returns the validator's unique name Name() string // ErrorMessage returns a basic error message for validation failures ErrorMessage(ctx *core.ParseContext) string }
ZodValidator represents a basic validator interface for type T
Click to show internal directories.
Click to hide internal directories.