Documentation
¶
Overview ¶
Package validator provides configuration validation functionality using the go-playground/validator library. It supports both struct tag validation and custom validation through the Validator interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
Validate performs comprehensive validation on the provided value. It first runs struct tag validation using the go-playground/validator library, then checks if the value implements the Validator interface for custom validation.
The validation process: 1. Checks for nil values 2. Performs struct tag validation (required, format, etc.) 3. Calls custom Validate() method if the type implements Validator interface
Returns an error if any validation step fails.
Types ¶
type Validator ¶
type Validator interface {
// Validate performs custom validation and returns an error if validation fails
Validate() error
}
Validator defines an interface for custom validation logic. Types implementing this interface can provide their own validation rules beyond the standard struct tag validation.