Documentation ¶
Index ¶
- func JWTAuth() gin.HandlerFunc
- func RecoveryMiddleware() gin.HandlerFunc
- func RequestInLog(c *gin.Context)
- func RequestLog() gin.HandlerFunc
- func RequestOutLog(c *gin.Context)
- func ResponseError(c *gin.Context, err error)
- func ResponseSuccess(c *gin.Context, data interface{})
- func TranslationMiddleware() gin.HandlerFunc
- type Response
- type ResponseCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RecoveryMiddleware ¶
func RecoveryMiddleware() gin.HandlerFunc
RecoveryMiddleware RecoveryMiddleware捕获所有panic,并且返回错误信息
func RequestLog ¶
func RequestLog() gin.HandlerFunc
func ResponseError ¶
func ResponseSuccess ¶
Types ¶
type Response ¶
type Response struct { ErrorCode ResponseCode `json:"errno"` ErrorMsg string `json:"errmsg"` RealErr string `json:"real_err"` Data interface{} `json:"data"` TraceId interface{} `json:"trace_id"` Stack interface{} `json:"stack"` }
type ResponseCode ¶
type ResponseCode int
const (
SuccessCode ResponseCode = iota
)
1000以下为通用码,1000以上为用户自定义码
Click to show internal directories.
Click to hide internal directories.