Documentation ¶
Index ¶
- Variables
- func TranslatorFromCtx(ctx *fiber.Ctx) ut.Translator
- func ValidBody(ctx *fiber.Ctx, dest any) error
- func ValidCategory(ctx *fiber.Ctx, category string) error
- func ValidQuery(ctx *fiber.Ctx, dest any) error
- func ValidServer(ctx *fiber.Ctx, server string) error
- func ValidStruct(ctx *fiber.Ctx, dest any) error
- func ValidVar(ctx *fiber.Ctx, field any, tag string) error
- type ErrorResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var Validate = util.NewValidator()
Functions ¶
func TranslatorFromCtx ¶
func TranslatorFromCtx(ctx *fiber.Ctx) ut.Translator
func ValidBody ¶
ValidBody will get the body from *fiber.Ctx using fiber#BodyParser(), and validate it using the validator singleton. If the validation passed it will write the unmarshalled body to dest and return a nil, otherwise it will return an error. Notice that dest shall always be a pointer.
func ValidCategory ¶
func ValidQuery ¶
ValidQuery will get the query from *fiber.Ctx using fiber#QueryParser(), and validate it using the validator singleton. If the validation passed it will write the unmarshalled query to dest and return a nil, otherwise it will return an error. Notice that dest shall always be a pointer.
func ValidServer ¶
func ValidStruct ¶
Types ¶
type ErrorResponse ¶
type ErrorResponse struct { Field string `json:"field,omitempty"` Violation string `json:"violation"` Message string `json:"message"` }
func ValidateStruct ¶
func ValidateStruct(ctx *fiber.Ctx, s any) []*ErrorResponse
Click to show internal directories.
Click to hide internal directories.