Documentation ¶
Index ¶
- func RecoveryMiddleware() gin.HandlerFunc
- func RequestInLog(c *gin.Context)
- func RequestLog() gin.HandlerFunc
- func RequestOutLog(c *gin.Context)
- func ResponseError(c *gin.Context, code ResponseCode, 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捕获所有panic,并且返回错误信息
func RequestLog ¶
func RequestLog() gin.HandlerFunc
func ResponseError ¶
func ResponseError(c *gin.Context, code ResponseCode, err error)
func ResponseSuccess ¶
Types ¶
type Response ¶
type Response struct { Code ResponseCode `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` Stack interface{} `json:"stack"` }
type ResponseCode ¶
type ResponseCode int
const ( SuccessCode ResponseCode = iota + 1000 UndefErrorCode ValidErrorCode InternalErrorCode )
Click to show internal directories.
Click to hide internal directories.