Documentation
¶
Index ¶
- func DecorateWithBody[T any](h func(c *fiber.Ctx, body *T) error) fiber.Handler
- func DecorateWithBodyEx[T any](validate *validator.Validate, h func(c *fiber.Ctx, body *T) error) fiber.Handler
- func GetValidatedBody[T any](c *fiber.Ctx) (*T, bool)
- func Middleware(c *fiber.Ctx) error
- func NewBody[T any](validate *validator.Validate) fiber.Handler
- func NewErrors(err error) error
- func ValidateBody[T any](c *fiber.Ctx, validate *validator.Validate) (*T, error)
- type Error
- type Errors
- type Validatable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecorateWithBody ¶
DecorateWithBody decorates a handler with the validated request.
func DecorateWithBodyEx ¶
func DecorateWithBodyEx[T any](validate *validator.Validate, h func(c *fiber.Ctx, body *T) error) fiber.Handler
DecorateWithBodyEx decorates a handler with the validated request.
func GetValidatedBody ¶
GetValidatedBody retrieves the validated request from the context.
func Middleware ¶
Types ¶
type Error ¶
type Error struct {
Field string `json:"field"`
Tag string `json:"tag"`
Value string `json:"value,omitempty"`
Message string `json:"message"`
}
Error represents a validation error with field details.
type Validatable ¶ added in v0.6.0
type Validatable interface {
Validate() error
}
Validatable is an interface that types can implement to provide custom validation logic beyond struct-tag-based validation. When implemented, Validate() is called after struct-tag validation in ValidateBody and related functions.
Click to show internal directories.
Click to hide internal directories.