Documentation ¶
Index ¶
- Constants
- Variables
- func Error(c *gin.Context, code int, message string, data ...interface{})
- func ErrorCode(c *gin.Context, code int)
- func GetParams(c *gin.Context, params interface{}) error
- func Success(c *gin.Context, code int, message string, data ...interface{})
- func SuccessCode(c *gin.Context, code int)
- type HTTPResponse
Constants ¶
View Source
const ( Ok = 0 ErrorBadRequest = 400001 ErrorMissToken = 400002 ErrorForbidden = 403001 ErrorNotFound = 404001 ErrorMethodNotAllowed = 405001 ErrorParamsWrong = 422001 ErrorSystem = 500001 ErrorFileNotFound = 500002 ErrorConnectTimeout = 504001 )
Variables ¶
View Source
var CodeStatus = map[int]int{ Ok: http.StatusOK, ErrorBadRequest: http.StatusBadRequest, ErrorMissToken: http.StatusBadRequest, ErrorUnauthorized: http.StatusUnauthorized, ErrorForbidden: http.StatusForbidden, ErrorNotFound: http.StatusNotFound, ErrorMethodNotAllowed: http.StatusMethodNotAllowed, ErrorParamsWrong: http.StatusUnprocessableEntity, ErrorSystem: http.StatusInternalServerError, ErrorFileNotFound: http.StatusInternalServerError, ErrorConnectTimeout: http.StatusGatewayTimeout, }
Functions ¶
func SuccessCode ¶
Types ¶
type HTTPResponse ¶
type HTTPResponse struct { Code int `json:"code"` Message interface{} `json:"message"` Data interface{} `json:"data"` }
Click to show internal directories.
Click to hide internal directories.