Documentation
¶
Index ¶
- func BadRequestError(c *gin.Context, message string)
- func BusinessError(c *gin.Context, err error)
- func Error(c *gin.Context, err error)
- func ForbiddenError(c *gin.Context, err error)
- func MethodNotAllowedError(c *gin.Context, err error)
- func NotFoundError(c *gin.Context, err error)
- func PanicError(c *gin.Context, err any)
- func ServerError(c *gin.Context, err error)
- func Success(c *gin.Context, data any)
- func SuccessWithMessage(c *gin.Context, message string, data any)
- func TooManyRequestsError(c *gin.Context, err error)
- func UnauthorizedError(c *gin.Context)
- func ValidationError(c *gin.Context, err error)
- type Response
- type StackFrame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BadRequestError ¶ added in v1.3.2
BadRequestError 错误请求
func MethodNotAllowedError ¶
MethodNotAllowedError 方法不允许
func PanicError ¶ added in v1.3.2
PanicError Panic 错误响应(用于 recovery 中间件)
func SuccessWithMessage ¶ added in v1.3.2
SuccessWithMessage 成功响应(自定义消息)
func TooManyRequestsError ¶ added in v1.3.2
TooManyRequestsError 请求过多
Types ¶
type Response ¶
type Response struct {
Code int `json:"code"` // 业务状态码
Message string `json:"message"` // 响应消息
Data any `json:"data,omitempty"` // 响应数据
ErrorPath string `json:"error_path,omitempty"` // 错误路径(仅开发环境)
Function string `json:"error_function,omitempty"` // 错误函数(仅开发环境)
Extra any `json:"extra,omitempty"` // 额外信息
}
Response 统一响应结构
Click to show internal directories.
Click to hide internal directories.