Documentation
¶
Index ¶
- func ApplySchemaParams(def *core.ZodTypeDef, params *core.SchemaParams)
- func CompareValues(a, b any) int
- func ContainsString(slice []string, value string) bool
- func CreateErrorContext(code core.IssueCode, path []any, input any) map[string]any
- func EscapeRegex(str string) string
- func ExtractErrorInfo(issue core.ZodRawIssue) map[string]any
- func FormatErrorPath(path []any, style string) string
- func GetFirstParam(params ...any) any
- func GetLengthableOrigin(value any) string
- func GetNumericOrigin(value any) string
- func GetOriginFromValue(value any) string
- func GetParsedType(value any) core.ParsedType
- func GetSizableOrigin(value any) string
- func IndexOfString(slice []string, value string) int
- func IsPrimitiveType(typeName core.ZodTypeCode) bool
- func IsPrimitiveValue(value any) bool
- func MergeStringSlices(slicesInput ...[]string) []string
- func NormalizeCustomParams(params ...any) *core.CustomParams
- func NormalizeParams(params ...any) *core.SchemaParams
- func ToDotPath(path []any) string
- func ToErrorMap(err any) (*core.ZodErrorMap, bool)
- func TypeDescription(value any) string
- func UniqueStrings(input []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplySchemaParams ¶ added in v0.3.0
func ApplySchemaParams(def *core.ZodTypeDef, params *core.SchemaParams)
ApplySchemaParams applies SchemaParams to a type definition Updates the definition with normalized parameters
func CompareValues ¶
CompareValues compares two values, returns -1, 0, or 1 Automatically dereferences pointers before comparison
func ContainsString ¶ added in v0.5.1
ContainsString checks if a string slice contains a specific value
func CreateErrorContext ¶ added in v0.4.0
CreateErrorContext creates error context for formatting
func EscapeRegex ¶
EscapeRegex escapes special characters in a string for use in regex Optimized with precise memory allocation following TypeScript v4 patterns
func ExtractErrorInfo ¶ added in v0.4.0
func ExtractErrorInfo(issue core.ZodRawIssue) map[string]any
ExtractErrorInfo extracts error information from a raw issue
func FormatErrorPath ¶ added in v0.4.0
FormatErrorPath formats an error path for display
func GetFirstParam ¶ added in v0.3.0
GetFirstParam extracts the first parameter from variadic arguments Provides convenience for Go's variadic parameter style while maintaining compatibility with Zod TypeScript v4's single parameter pattern Returns nil if no parameters provided
func GetLengthableOrigin ¶
GetLengthableOrigin returns the origin type for lengthable values
func GetNumericOrigin ¶
GetNumericOrigin determines the numeric origin type for error messages
func GetOriginFromValue ¶
GetOriginFromValue smartly determines the origin of a value (general purpose)
func GetParsedType ¶
func GetParsedType(value any) core.ParsedType
GetParsedType performs type detection by delegating to pkg/reflectx.ParsedType This ensures consistency across the codebase and avoids duplication
func GetSizableOrigin ¶
GetSizableOrigin determines the origin type for sizable values
func IndexOfString ¶ added in v0.5.1
IndexOfString finds the index of a string in a slice, returns -1 if not found
func IsPrimitiveType ¶ added in v0.2.1
func IsPrimitiveType(typeName core.ZodTypeCode) bool
IsPrimitiveType checks if a schema type is a primitive type that supports coercion Only primitive types should support coercion according to TypeScript Zod v4 alignment
func IsPrimitiveValue ¶ added in v0.5.1
IsPrimitiveValue checks if a value is of a primitive type for fast-path optimization Uses pkg/reflectx functions for consistent type checking
func MergeStringSlices ¶ added in v0.5.1
MergeStringSlices efficiently merges multiple string slices
func NormalizeCustomParams ¶ added in v0.3.1
func NormalizeCustomParams(params ...any) *core.CustomParams
NormalizeCustomParams normalizes input parameters into a standard CustomParams struct Supports variadic arguments where the first parameter is used: - nil -> empty CustomParams - string -> { Error: string } - CustomParams -> normalized copy - *CustomParams -> normalized copy - any -> { Error: any }
func NormalizeParams ¶ added in v0.3.0
func NormalizeParams(params ...any) *core.SchemaParams
NormalizeParams normalizes input parameters into a standard SchemaParams struct Supports variadic arguments where the first parameter is used: - nil -> empty SchemaParams - string -> { Error: string } - SchemaParams -> normalized copy - *SchemaParams -> normalized copy
func ToDotPath ¶ added in v0.4.0
ToDotPath converts an error path to dot notation string Compatible with TypeScript Zod v4 path formatting Optimized with precise memory allocation
func ToErrorMap ¶ added in v0.3.0
func ToErrorMap(err any) (*core.ZodErrorMap, bool)
ToErrorMap converts various error representations to ZodErrorMap Supports: string, ZodErrorMap, *ZodErrorMap, func(ZodRawIssue) string
func TypeDescription ¶ added in v0.5.1
TypeDescription returns a human-readable type description for error messages Delegates to pkg/reflectx.ParsedCategory for consistent behavior
func UniqueStrings ¶ added in v0.5.1
UniqueStrings returns unique string values
Types ¶
This section is empty.