responsex

package
v0.0.0-...-fefde71 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddErrorHandlingMiddleware

func AddErrorHandlingMiddleware() gin.HandlerFunc

AddErrorHandlingMiddleware is used to add error handling middleware.

func Err

func Err(c *gin.Context, err error)

Err is a function that returns a response with status code 500.

func OK

func OK(c *gin.Context, data any)

OK is a function that returns a response with status code 200.

func WithCode

func WithCode(c *gin.Context, code int, data any)

WithCode is a function that returns a response with the specified status code.

Types

type Response

type Response struct {
	Code    int    `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
	Data    any    `json:"data,omitempty"`
}

Response is a struct that represents the response of the API.

Jump to

Keyboard shortcuts

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