resp

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleBadRequest

func HandleBadRequest(ctx *gin.Context, message string)

HandleBadRequest sends a 400 Bad Request response

func HandleError

func HandleError(ctx *gin.Context, statusCode int, errorCode int, message string, data interface{})

HandleError sends an error response

func HandleErrorWithStatus

func HandleErrorWithStatus(ctx *gin.Context, statusCode int, message string)

HandleErrorWithStatus sends an error response with custom status and message

func HandleForbidden

func HandleForbidden(ctx *gin.Context, message string)

HandleForbidden sends a 403 Forbidden response

func HandleInternalError

func HandleInternalError(ctx *gin.Context, message string)

HandleInternalError sends a 500 Internal Server Error response

func HandleNotFound

func HandleNotFound(ctx *gin.Context, message string)

HandleNotFound sends a 404 Not Found response

func HandleSuccess

func HandleSuccess(ctx *gin.Context, data interface{})

HandleSuccess sends a successful response

func HandleUnauthorized

func HandleUnauthorized(ctx *gin.Context, message string)

HandleUnauthorized sends a 401 Unauthorized response

Types

type Response

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

Response represents the standard API response structure

Jump to

Keyboard shortcuts

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