resp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	ErrBadRequest        = "Invalid request parameters"
	ErrInvalidJSON       = "Invalid JSON format"
	ErrInvalidParam      = "Invalid parameter"
	ErrValidation        = "Input validation failed"
	ErrDuplicateResource = "Resource already exists"
	ErrResourceNotFound  = "Resource not found"
	ErrInternalServer    = "An unexpected error occurred"
	ErrDatabase          = "Database operation failed"
	ErrUnauthorized      = "Authentication failed"
	ErrTooManyRequests   = "Too many requests"
)

Variables

This section is empty.

Functions

func BadGateway

func BadGateway(c *gin.Context)

func Error

func Error(c *gin.Context, code int, err string)

func ErrorWithAppError

func ErrorWithAppError(c *gin.Context, fallbackStatus int, err error)

func ErrorWithCodeAndParams

func ErrorWithCodeAndParams(c *gin.Context, status int, code string, message string, params map[string]any)

func ErrorWithKey

func ErrorWithKey(c *gin.Context, code int, err string, messageKey string, messageArgs map[string]any)

func InternalError

func InternalError(c *gin.Context)

func InvalidJSON

func InvalidJSON(c *gin.Context)

func InvalidParam

func InvalidParam(c *gin.Context)

func Success

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

Types

type ResponseStruct

type ResponseStruct struct {
	Code        int            `json:"code" example:"200"`
	Message     string         `json:"message" example:"success"`
	MessageKey  string         `json:"message_key,omitempty"`
	MessageArgs map[string]any `json:"message_args,omitempty"`
	Data        interface{}    `json:"data,omitempty"`
}

Jump to

Keyboard shortcuts

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