response

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BusinessError

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

业务错误

func ErrorPanic

func ErrorPanic(c *gin.Context, err any)

Error Panic 错误响应

func ForbiddenError

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

禁止访问

func MethodNotAllowedError

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

方法不允许

func NotFoundError

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

未找到

func ServerError

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

服务器内部错误

func Success

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

Success 成功响应

func TooManyRequests

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

请求过多

func UnauthorizedError

func UnauthorizedError(c *gin.Context)

未授权

func ValidationError

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

参数验证错误

Types

type Response

type Response struct {
	Code        int                `json:"code"`
	Message     string             `json:"message"`
	ErrorPath   string             `json:"error_path,omitempty"`
	Function    string             `json:"error_function,omitempty"`
	Data        any                `json:"data,omitempty"`
	RequestInfo *requests.Requests `json:"request_info,omitempty"`
	Extra       any                `json:"extra,omitempty"`
}

Response 统一响应结构

type Stackconfig

type Stackconfig struct {
	Function string `json:"function"`  // 函数名
	File     string `json:"file"`      // 文件名
	Line     int    `json:"line"`      // 行号
	FullPath string `json:"full_path"` // 完整路径
}

Stackconfig 堆栈帧结构

Jump to

Keyboard shortcuts

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