Documentation ¶
Index ¶
- Constants
- Variables
- func Wrapper(myCtxHandler func(*Context)) func(*gin.Context)
- type Context
- func (c *Context) RepCtxErrThenAbort()
- func (c *Context) RepDBErrThenAbort()
- func (c *Context) RepHttpOK(msg string)
- func (c *Context) RepJWTErrThenAbort()
- func (c *Context) RepJsonOk(j interface{})
- func (c *Context) RepLocalIOErr()
- func (c *Context) RepNoDesiredDataErrThenAbort()
- func (c *Context) RepNoPrivilegeErr()
- func (c *Context) RepNoSQLDataErrThenAbort()
- func (c *Context) RepNoSessionIDErr()
- func (c *Context) RepParamOrQueryErrThenAbort()
- func (c *Context) RepRemoteApiErrThenAbort()
- func (c *Context) RepSessionExpireErrThenAbort()
- func (c *Context) RepWebSocketErrThenAbort()
- func (c *Context) ReportErr(errCode int, errMsg string)
- type RetMessage
Constants ¶
View Source
const ( InvalidJWTErr = 4000 + iota JWTGenErr UnknownErr NoSuchSQLDataErr ContextErr NoDesiredRequestDataErr RemoteAPIErr WsErr SessionExpiredErr NoFreeSessionIDErr DBErr ParamOrQueryErr NoPrivilegeErr LocalIOErr )
Errors
View Source
const (
NoErr = 2000 + iota
)
Variables ¶
View Source
var ErrCodeDict = map[int]string{ InvalidJWTErr: "JWT 无效或错误!", JWTGenErr: "无法生成有效的 JWT!", UnknownErr: "未知错误", NoSuchSQLDataErr: "无此数据或用户!", ContextErr: "无法从 Context 中获取键值对", NoDesiredRequestDataErr: "请求体中的数据格式或内容不正确!", RemoteAPIErr: "调用微信api获取数据时出现错误!", WsErr: "处理websocket过程中出错!", SessionExpiredErr: "SessionID 过期或未请求过 SessionId!", DBErr: "数据库读/写出错", ParamOrQueryErr: "请求携带的参数错误", NoPrivilegeErr: "用户没有所需的特权", }
Functions ¶
Types ¶
type Context ¶
func (*Context) RepCtxErrThenAbort ¶
func (c *Context) RepCtxErrThenAbort()
func (*Context) RepDBErrThenAbort ¶
func (c *Context) RepDBErrThenAbort()
func (*Context) RepJWTErrThenAbort ¶
func (c *Context) RepJWTErrThenAbort()
func (*Context) RepLocalIOErr ¶
func (c *Context) RepLocalIOErr()
func (*Context) RepNoDesiredDataErrThenAbort ¶
func (c *Context) RepNoDesiredDataErrThenAbort()
func (*Context) RepNoPrivilegeErr ¶
func (c *Context) RepNoPrivilegeErr()
func (*Context) RepNoSQLDataErrThenAbort ¶
func (c *Context) RepNoSQLDataErrThenAbort()
func (*Context) RepNoSessionIDErr ¶
func (c *Context) RepNoSessionIDErr()
func (*Context) RepParamOrQueryErrThenAbort ¶
func (c *Context) RepParamOrQueryErrThenAbort()
func (*Context) RepRemoteApiErrThenAbort ¶
func (c *Context) RepRemoteApiErrThenAbort()
func (*Context) RepSessionExpireErrThenAbort ¶
func (c *Context) RepSessionExpireErrThenAbort()
func (*Context) RepWebSocketErrThenAbort ¶
func (c *Context) RepWebSocketErrThenAbort()
type RetMessage ¶
func ExportErr ¶
func ExportErr(errCode int) RetMessage
Click to show internal directories.
Click to hide internal directories.