Documentation ¶
Index ¶
Constants ¶
View Source
const ( // 正常 OK int = 0 // 参数错误 ParamsError int = 4001 // 数据错误 DataError int = 4002 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Response ¶
type Response struct { // 是否成功 Success bool `json:"success"` // 错误代码 ErrorCode int `json:"error_code"` // 消息 Message string `json:"message"` // 数据项 Data interface{} `json:"data"` }
Response Http响应
func NewResponse ¶
NewResponse 创建响应
func NewResponseError ¶
func NewResponseError(err interface{}, data ...interface{}) *Response
NewResponseError 创建错误响应, 显示原始错误
func NewResponseOK ¶
NewResponseOK 创建成功响应
Click to show internal directories.
Click to hide internal directories.