Documentation ¶
Index ¶
- Variables
- func GxContextWrap(handler GxHandlerFunc) gin.HandlerFunc
- type ApiCls
- func (api *ApiCls) ReturnAuthorFailError(c *gin.Context)
- func (api *ApiCls) ReturnError(c *gin.Context, msg string, code ...ApiResultCode)
- func (api *ApiCls) ReturnForbiddenError(c *gin.Context)
- func (api *ApiCls) ReturnInnerError(c *gin.Context)
- func (api *ApiCls) ReturnJson(c *gin.Context, code ApiResultCode, content any, msg ...string)
- func (api *ApiCls) ReturnNotfoundError(c *gin.Context)
- func (api *ApiCls) ReturnSuccess(c *gin.Context, content interface{}, msg ...string)
- type ApiResponseData
- type ApiResultCode
- type GXContext
- func (c *GXContext) AllParams() gtype.GMap
- func (c *GXContext) BindParams(params any) error
- func (c *GXContext) ReturnAuthFail()
- func (c *GXContext) ReturnError(msg string, code ...ApiResultCode)
- func (c *GXContext) ReturnErrors(msg string, errors error, code ...ApiResultCode)
- func (c *GXContext) ReturnForbiddenError()
- func (c *GXContext) ReturnInnerError()
- func (c *GXContext) ReturnJson(code ApiResultCode, content any, msg ...string)
- func (c *GXContext) ReturnNotfoundError()
- func (c *GXContext) ReturnSuccess(content interface{}, msg ...string)
- type GxHandlerFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var Api = ApiCls{}
Functions ¶
func GxContextWrap ¶
func GxContextWrap(handler GxHandlerFunc) gin.HandlerFunc
Types ¶
type ApiCls ¶
type ApiCls struct{}
func (*ApiCls) ReturnAuthorFailError ¶
func (*ApiCls) ReturnError ¶
func (api *ApiCls) ReturnError(c *gin.Context, msg string, code ...ApiResultCode)
ReturnError 出错
func (*ApiCls) ReturnForbiddenError ¶
func (*ApiCls) ReturnInnerError ¶
func (*ApiCls) ReturnJson ¶
func (*ApiCls) ReturnNotfoundError ¶
type ApiResponseData ¶
type ApiResponseData struct { Time int64 `json:"t"` Code ApiResultCode `json:"code"` Msg string `json:"msg,omitempty"` Content interface{} `json:"content,omitempty"` }
ApiResponseData api接口返回的结果:
type ApiResultCode ¶
type ApiResultCode int
const ( ApiResultSuccessCode ApiResultCode = 0 ApiResultAppErrCode ApiResultCode = 1 ApiResultAuthFailErrCode ApiResultCode = 401 ApiResultForbiddenErrCode ApiResultCode = 403 ApiResultNotfoundErrCode ApiResultCode = 404 ApiResultInnerErrCode ApiResultCode = 500 )
type GXContext ¶
func (*GXContext) BindParams ¶
func (*GXContext) ReturnAuthFail ¶
func (c *GXContext) ReturnAuthFail()
func (*GXContext) ReturnError ¶
func (c *GXContext) ReturnError(msg string, code ...ApiResultCode)
func (*GXContext) ReturnErrors ¶
func (c *GXContext) ReturnErrors(msg string, errors error, code ...ApiResultCode)
func (*GXContext) ReturnForbiddenError ¶
func (c *GXContext) ReturnForbiddenError()
func (*GXContext) ReturnInnerError ¶
func (c *GXContext) ReturnInnerError()
func (*GXContext) ReturnJson ¶
func (c *GXContext) ReturnJson(code ApiResultCode, content any, msg ...string)
func (*GXContext) ReturnNotfoundError ¶
func (c *GXContext) ReturnNotfoundError()
func (*GXContext) ReturnSuccess ¶
type GxHandlerFunc ¶
type GxHandlerFunc func(*GXContext)
Click to show internal directories.
Click to hide internal directories.