Documentation
¶
Index ¶
- func AutoValidate[Req, Res any](b *action.Builder[Req, Res]) *action.Builder[Req, Res]
- func CompileWithTimeout(pattern string, timeout time.Duration) *regexp.Regexp
- func FromValidatorError(err error) *xerr.AppError
- func IsValidEmail(email string) bool
- func IsValidUUID(id string) bool
- func New() action.AnyAction
- func RegisterCustom(tag string, fn validator.FuncCtx)
- func RegisterType(fn validator.CustomTypeFunc, types ...any)
- func Struct(ctx context.Context, value any) error
- func TrimStringFields(value any)
- func ValidateAction[T any](name string) *action.BuiltAction[T, T]
- type Validatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AutoValidate ¶
AutoValidate wires Kernel's .Validate(...) builder contract directly to validation.Struct, mapping validator/v10 errors into clean xerr.ValidationDetails.
func CompileWithTimeout ¶
CompileWithTimeout prevents ReDoS attacks on dynamic patterns.
func FromValidatorError ¶
FromValidatorError maps validator/v10 field errors to Nexss structured details with readable messages.
func IsValidEmail ¶
func IsValidUUID ¶
func RegisterCustom ¶
RegisterCustom registers context-aware validation rules safely at cold-path init.
func RegisterType ¶
func RegisterType(fn validator.CustomTypeFunc, types ...any)
RegisterType registers custom type handlers safely at cold-path init.
func Struct ¶
Struct validates exported fields using `validate:"..."` tags. Automatically trims leading and trailing whitespace from string fields prior to tag evaluation.
func TrimStringFields ¶
func TrimStringFields(value any)
TrimStringFields recurses through exported string fields in structs, pointers, and slices, trimming leading and trailing whitespace in-place.
func ValidateAction ¶
func ValidateAction[T any](name string) *action.BuiltAction[T, T]
ValidateAction creates an identity action that validates T using validate tags.
Types ¶
type Validatable ¶
type Validatable interface {
Validate() error
}
Validatable allows structs to execute custom semantic validation logic.