Documentation
¶
Overview ¶
Package validation provides custom validation rules for the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Email = validation.NewStringRuleWithError( func(s string) bool { return emailRegex.MatchString(s) }, validation.NewError("validation_email_format", "must be a valid email address"), )
Email validates email format using regex
View Source
var NoWhitespace = validation.NewStringRuleWithError( func(s string) bool { return s == strings.TrimSpace(s) }, validation.NewError("validation_no_whitespace", "must not contain leading or trailing whitespace"), )
NoWhitespace validates that string doesn't contain leading/trailing whitespace
View Source
var NotBlank = validation.NewStringRuleWithError( func(s string) bool { return strings.TrimSpace(s) != "" }, validation.NewError("validation_not_blank", "must not be blank"), )
NotBlank validates that a string is not empty after trimming whitespace
Functions ¶
func WrapValidationError ¶
WrapValidationError wraps validation errors as domain ErrInvalidInput
Types ¶
type PasswordStrength ¶
type PasswordStrength struct {
MinLength int
RequireUpper bool
RequireLower bool
RequireNumber bool
RequireSpecial bool
}
PasswordStrength validates password meets minimum security requirements
func (PasswordStrength) Validate ¶
func (p PasswordStrength) Validate(value interface{}) error
Validate checks if the password meets the configured requirements
Click to show internal directories.
Click to hide internal directories.