handlers

package
v0.0.0-...-6b488ef Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(c *fiber.Ctx, err error) error

ErrorHandler is used to catch error thrown inside the routes by ctx.Next(err)

func ParseBody

func ParseBody(ctx *fiber.Ctx, body interface{}) *fiber.Error

ParseBody is helper function for parsing the body. Is any error occurs it will panic. Its just a helper function to avoid writing if condition again n again.

func ParseBodyAndValidate

func ParseBodyAndValidate(ctx *fiber.Ctx, body interface{}) *fiber.Error

ParseBodyAndValidate is helper function for parsing the body. Is any error occurs it will panic. Its just a helper function to avoid writing if condition again n again.

func Validate

func Validate(payload interface{}) *fiber.Error

Validate validates the input struct

Types

type HTTPError

type HTTPError struct {
	Status string `json:"status" example:"error"`          // The status error of string.
	Error  string `json:"error" example:"a message error"` // The message error description of string.
}

HTTPError defines the field which should be the response.

type HTTPSuccess

type HTTPSuccess struct {
	Status string      `json:"status" example:"success"` // The status success of string.
	Data   interface{} `json:"data"`                     // The result of json.
}

HTTPSuccess defines the field which should be the response.

Jump to

Keyboard shortcuts

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