response

package
v0.0.0-...-4a018e9 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadRequest          = errors.New("the server could not understand the request due to invalid syntax or missing parameters")
	ErrForbiden            = errors.New("the server understood the request, but it refuses to authorize it. The client does not have the necessary permissions")
	ErrInternalServerError = errors.New("an unexpected error occurred on the server. Please try again later")
	ErrUnprocessableEntity = errors.New("the server understands the request, but it cannot process the provided data due to semantic errors")
	ErrNotFound            = errors.New("the requested resource could not be found on the server")
)

Functions

func BadRequest

func BadRequest(c *fiber.Ctx) error

func BadRequestWithErrors

func BadRequestWithErrors(c *fiber.Ctx, innerErrors []error) error

func Created

func Created(c *fiber.Ctx, data interface{}) error

func Error

func Error(c *fiber.Ctx, statusCode int, err error) error

func ErrorWithDetails

func ErrorWithDetails(c *fiber.Ctx, statusCode int, errorMesage error, errs []error) error

func Forbiden

func Forbiden(c *fiber.Ctx) error

func InternalServerError

func InternalServerError(c *fiber.Ctx) error

func NotFound

func NotFound(c *fiber.Ctx) error

func OK

func OK(c *fiber.Ctx, data interface{}) error

func Success

func Success(c *fiber.Ctx, statusCode int, data interface{}) error

func UnprocessableEntity

func UnprocessableEntity(c *fiber.Ctx) error

Types

type Response

type Response struct {
	Code   int      `json:"code"`
	Msg    string   `json:"mesage"`
	Errors []string `json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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