Documentation
¶
Index ¶
- Variables
- func ErrorHandler(resp *ResponseCode, errMsg string, c *gin.Context, abort bool)
- func GeneralDBHandler(err error, c *gin.Context)
- func GeneralErrorHandler(err error, c *gin.Context)
- func GeneralErrorMessageHandler(errMsg string, c *gin.Context)
- func GeneralParamHandler(err error, c *gin.Context)
- func GeneralParamMessageHandler(errMsg string, c *gin.Context)
- func GeneralResultHandler(result interface{}, err error, c *gin.Context)
- func GeneralSuccessHandler(result interface{}, c *gin.Context)
- func GeneralSuccessMessageHandler(message string, c *gin.Context)
- func SystemErrorHandler(err error, c *gin.Context)
- type PageInfo
- type PageResult
- type Response
- func (re *Response) Init(code *ResponseCode, hint string, result interface{})
- func (re *Response) InitError(code *ResponseCode, hint string)
- func (re *Response) InitFromResp(srcResp *Response)
- func (re *Response) InitPageSuccess(totalPages, pageNo, pageSize int, results interface{})
- func (re *Response) InitSuccess()
- func (re *Response) InitSuccessFull(hint string, result interface{})
- func (re *Response) InitSuccessHint(hint string)
- func (re *Response) InitSuccessResult(result interface{})
- func (re *Response) IsSuccess() bool
- type ResponseCode
Constants ¶
This section is empty.
Variables ¶
View Source
var CacheError = &ResponseCode{Code: "RC81001", Info: "缓存操作失败"}
View Source
var DB_ERROR = &ResponseCode{Code: "RC80000", Info: "DBError"}
View Source
var DB_NOT_FOUND = &ResponseCode{Code: "RC80404", Info: "DBError: record not found"}
View Source
var GENERAL_ERROR = &ResponseCode{Code: "RC60000", Info: "FAILURE"}
View Source
var MGMT_TOKEN_DISABLE_ERROR = &ResponseCode{Code: "RC50090", Info: "MgmtTokenDisabled"}
View Source
var MGMT_TOKEN_EXPIRE_ERROR = &ResponseCode{Code: "RC50099", Info: "MgmtTokenExpireOrInvalid: %s"}
View Source
var PARAM_ERROR = &ResponseCode{Code: "RC70000", Info: "ParamError"}
View Source
var SUCCESS = &ResponseCode{Code: "RC00000", Info: "SUCCESS"}
View Source
var SYS_ERROR = &ResponseCode{Code: "RC90000", Info: "SysError"}
View Source
var TOKEN_EXPIRE_ERROR = &ResponseCode{Code: "RC50000", Info: "TokenExpireOrInvalid"}
Functions ¶
func ErrorHandler ¶ added in v1.0.1
func ErrorHandler(resp *ResponseCode, errMsg string, c *gin.Context, abort bool)
func GeneralDBHandler ¶ added in v1.0.1
func GeneralErrorHandler ¶ added in v1.0.1
func GeneralErrorMessageHandler ¶ added in v1.0.1
func GeneralParamHandler ¶ added in v1.0.1
func GeneralParamMessageHandler ¶ added in v1.0.1
func GeneralResultHandler ¶ added in v1.0.1
func GeneralSuccessHandler ¶ added in v1.0.1
func GeneralSuccessMessageHandler ¶ added in v1.0.1
func SystemErrorHandler ¶ added in v1.0.1
Types ¶
type PageResult ¶
type PageResult struct {
PageInfo *PageInfo `json:"pageInfo,omitempty"`
Data interface{} `json:"data,omitempty"`
}
type Response ¶
type Response struct {
Code string `json:"code"`
Info string `json:"info"`
Result interface{} `json:"result,omitempty"`
}
func (*Response) Init ¶
func (re *Response) Init(code *ResponseCode, hint string, result interface{})
func (*Response) InitError ¶
func (re *Response) InitError(code *ResponseCode, hint string)
func (*Response) InitFromResp ¶
func (*Response) InitPageSuccess ¶
func (*Response) InitSuccess ¶
func (re *Response) InitSuccess()
func (*Response) InitSuccessFull ¶
func (*Response) InitSuccessHint ¶
func (*Response) InitSuccessResult ¶
func (re *Response) InitSuccessResult(result interface{})
type ResponseCode ¶
Click to show internal directories.
Click to hide internal directories.