rekuest

package
v0.0.0-...-570c91f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Validate = util.NewValidator()

Functions

func TranslatorFromCtx

func TranslatorFromCtx(ctx *fiber.Ctx) ut.Translator

func ValidBody

func ValidBody(ctx *fiber.Ctx, dest any) error

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 ValidCategory(ctx *fiber.Ctx, category string) error

func ValidQuery

func ValidQuery(ctx *fiber.Ctx, dest any) error

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 ValidServer(ctx *fiber.Ctx, server string) error

func ValidStruct

func ValidStruct(ctx *fiber.Ctx, dest any) error

func ValidVar

func ValidVar(ctx *fiber.Ctx, field any, tag string) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL