Documentation ¶
Index ¶
- func Fail(c *gin.Context, code int, args ...interface{})
- func Ok(c *gin.Context, args ...interface{})
- func Out(c *gin.Context, code int, args ...interface{})
- func Register(name string, sf Strapper)
- func Routers(r gin.IRouter, names ...string)
- type Error
- type ICodeErrorReq
- type IError
- type IFieldErrorReq
- type RespDone
- type RespFail
- type StrapFunc
- type Strapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct { Code int `json:"code" description:"错误代码"` Message string `json:"message,required" description:"错误信息"` Field string `json:"field,omitempty" description:"错误字段,可选,多用于表单校验"` }
Error ...
type ICodeErrorReq ¶ added in v0.12.2
ICodeErrorReq ...
type IFieldErrorReq ¶ added in v0.12.2
IFieldErrorReq ...
type RespDone ¶ added in v0.12.2
type RespDone struct { Ok bool `json:"ok,required" description:"操作成功"` // OK Data interface{} `json:"data,omitempty"` // main data Extra interface{} `json:"extra,omitempty"` // extra data }
RespDone 操作成功返回的结构
type RespFail ¶ added in v0.12.2
type RespFail struct { Ok bool `json:"ok" description:"操作失败"` Error Error `json:"error" description:"错误集"` }
RespFail 出现错误,返回相关的错误码和消息文本
Click to show internal directories.
Click to hide internal directories.