Versions in this module Expand all Collapse all v1 v1.4.1 Feb 15, 2026 Changes in this version + const RedactedValue + var DefaultSensitivePatterns = []string + var MaxCacheSize = 1000 + var MaxInputSize = 10 * 1024 * 1024 + var MaxStructureDepth = 64 + var MaxValidationDepth = 32 + func AddSensitiveFieldPattern(pattern string) + func ClearValidationCache() + func CoerceValue(value interface{}, targetType reflect.Type, fieldName string) (interface{}, error) + func CoerceValueWithFormat(value interface{}, targetType reflect.Type, fieldName string, format Format) (interface{}, error) + func GetMaxCacheSize() int + func GetMaxInputSize() int + func GetMaxStructureDepth() int + func GetMaxValidationDepth() int + func GetSensitiveFieldPatterns() []string + func IsSensitiveField(fieldName string) bool + func ParseIntoWithFormat[T any](raw []byte, format Format) (T, error) + func ParseInto[T any](raw []byte) (T, error) + func RegisterGlobalCrossFieldFunc(name string, validatorFunc CrossFieldValidatorFunc) + func RegisterGlobalFunc(name string, validatorFunc ValidatorFunc) + func SetMaxCacheSize(size int) + func SetMaxInputSize(size int) + func SetMaxStructureDepth(depth int) + func SetMaxValidationDepth(depth int) + func SetSensitiveFieldPatterns(patterns []string) + func ValidateValue(fieldName string, value interface{}, rules []ValidationRule) error + func ValidateValueWithStruct(fieldName string, value interface{}, rules []ValidationRule, ...) error + func Validate[T any](v *T) error + type AlphaValidator struct + func (v *AlphaValidator) Name() string + func (v *AlphaValidator) Validate(fieldName string, value interface{}) error + type AlphanumValidator struct + func (v *AlphanumValidator) Name() string + func (v *AlphanumValidator) Validate(fieldName string, value interface{}) error + type CacheConfig struct + CleanupInterval time.Duration + MaxEntries int + TTL time.Duration + func DefaultCacheConfig() *CacheConfig + type CachedParser struct + func NewCachedParser[T any](config *CacheConfig) *CachedParser[T] + func (cp *CachedParser[T]) ClearCache() + func (cp *CachedParser[T]) Close() + func (cp *CachedParser[T]) Parse(data []byte) (T, error) + func (cp *CachedParser[T]) ParseWithFormat(data []byte, format Format) (T, error) + func (cp *CachedParser[T]) Stats() (size, maxSize int, hitRate float64) + type CrossFieldValidator struct + func (v *CrossFieldValidator) Name() string + func (v *CrossFieldValidator) Validate(fieldName string, value interface{}) error + func (v *CrossFieldValidator) ValidateWithStruct(fieldName string, fieldValue interface{}, structValue reflect.Value) error + type CrossFieldValidatorFunc func(fieldName string, fieldValue interface{}, structValue reflect.Value, ...) error + type CustomFuncValidator struct + func (v *CustomFuncValidator) Name() string + func (v *CustomFuncValidator) Validate(fieldName string, value interface{}) error + type EmailValidator struct + func (v *EmailValidator) Name() string + func (v *EmailValidator) Validate(fieldName string, value interface{}) error + type ErrorList []error + func (el *ErrorList) Add(err error) + func (el ErrorList) AsError() error + func (el ErrorList) Error() string + func (el ErrorList) GroupByField() map[string][]*ValidationError + func (el ErrorList) HasErrors() bool + func (el ErrorList) ToJSON() ([]byte, error) + func (el ErrorList) ToStructuredReport() *StructuredErrorReport + func (el ErrorList) ValidationErrors() []*ValidationError + type FieldError struct + Errors []ValidationErrorInfo + Field string + FieldPath string + Value interface{} + type FieldValidation struct + FieldName string + JSONKey string + Rules []ValidationRule + type Format int + const FormatJSON + const FormatYAML + func DetectFormat(raw []byte) Format + type FormatParser interface + Format func() Format + Parse func(raw []byte) (interface{}, error) + func GetParser(format Format) FormatParser + type JSONParser struct + func (jp *JSONParser) Format() Format + func (jp *JSONParser) Parse(raw []byte) (interface{}, error) + type LengthValidator struct + Length int + func (v *LengthValidator) Name() string + func (v *LengthValidator) Validate(fieldName string, value interface{}) error + type MaxValidator struct + Max float64 + func (v *MaxValidator) Name() string + func (v *MaxValidator) Validate(fieldName string, value interface{}) error + type MinValidator struct + Min float64 + func (v *MinValidator) Name() string + func (v *MinValidator) Validate(fieldName string, value interface{}) error + type ParseError struct + Field string + Message string + Type string + Value interface{} + func NewParseError(field string, value interface{}, targetType, message string) *ParseError + func (e ParseError) Error() string + type RequiredValidator struct + func (v *RequiredValidator) Name() string + func (v *RequiredValidator) Validate(fieldName string, value interface{}) error + type StructValidation struct + Fields []FieldValidation + func ParseValidationTags(structType reflect.Type) *StructValidation + type StructuredErrorReport struct + Count int + Errors []FieldError + type ValidationError struct + Details map[string]interface{} + Field string + FieldPath string + Message string + Rule string + Value interface{} + func NewValidationError(field string, value interface{}, rule, message string) *ValidationError + func NewValidationErrorWithDetails(field, fieldPath string, value interface{}, rule, message string, ...) *ValidationError + func NewValidationErrorWithPath(field, fieldPath string, value interface{}, rule, message string) *ValidationError + func (e ValidationError) Error() string + func (e ValidationError) SanitizedValue() interface{} + type ValidationErrorInfo struct + Details map[string]interface{} + Message string + Rule string + type ValidationRule struct + Name string + Parameters map[string]interface{} + Validator Validator + type Validator interface + Name func() string + Validate func(fieldName string, value interface{}) error + type ValidatorFunc func(fieldName string, value interface{}, params map[string]interface{}) error + type ValidatorRegistry struct + func GetDefaultRegistry() *ValidatorRegistry + func NewValidatorRegistry() *ValidatorRegistry + func (r *ValidatorRegistry) Create(name string, params map[string]interface{}) Validator + func (r *ValidatorRegistry) ListValidators() []string + func (r *ValidatorRegistry) Register(name string, factory func(params map[string]interface{}) Validator) + func (r *ValidatorRegistry) RegisterCrossFieldFunc(name string, validatorFunc CrossFieldValidatorFunc) + func (r *ValidatorRegistry) RegisterFunc(name string, validatorFunc ValidatorFunc) + type YAMLParser struct + func (yp *YAMLParser) Format() Format + func (yp *YAMLParser) Parse(raw []byte) (interface{}, error)