response

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Http400

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

Http400 generates a 400 Bad Request response with logging

func Http401

func Http401(ctx *gin.Context)

Http401 generates a error 401 response with logging

func Http403

func Http403(ctx *gin.Context)

Http403 generates a 403 Forbidden response with logging

func Http404

func Http404(ctx *gin.Context)

Http404 generates a 404 Not Found response with logging

func Http429 added in v0.5.0

func Http429(ctx *gin.Context)

Http429 generates a 429 Too many requests

func Http500

func Http500(ctx *gin.Context, err error)

Http500 generates a 500 Internal Server Error response with logging

func Success added in v0.6.1

func Success(ctx *gin.Context, data any)

Success generates a JSON success response with an optional payload

func ValidationError

func ValidationError(ctx *gin.Context, errors interface{})

ValidationError generates a 400 Bad Request response with validation failed details

Types

type ErrorDetail

type ErrorDetail struct {
	Message      string      `json:"message,omitempty"`
	RequestError interface{} `json:"requestError,omitempty"`
}

type JSONResponse

type JSONResponse struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data,omitempty"`
}

type JSONResponseError

type JSONResponseError struct {
	Success bool        `json:"success"`
	Error   ErrorDetail `json:"error"`
}

Jump to

Keyboard shortcuts

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