Documentation ¶
Index ¶
- Constants
- func CodeJoinMsg(code int, msg ...string) (join string)
- func CodeToMsg(code int) (msg string, ok bool)
- func PutCodeMsgMap(code int, msg string)
- type ResultJson
- func CommonErrJson(code int, msg string, data ...interface{}) (result *ResultJson)
- func CommonJoinMsgErrJson(code int, msg string, data ...interface{}) (result *ResultJson)
- func NewResultJson(code int, message string, data interface{}) (result *ResultJson)
- func OtherFailedJson(msg string, data ...interface{}) (result *ResultJson)
- func RequestErrJson(msg string, data ...interface{}) (result *ResultJson)
- func RequestParaErrJson(msg string, data ...interface{}) (result *ResultJson)
- func ResponseInternalErrJson(msg string, data ...interface{}) (result *ResultJson)
- func SucJson(data interface{}) (result *ResultJson)
- func UnauthorizedErrJson(msg string, data ...interface{}) (result *ResultJson)
Constants ¶
View Source
const ( // FailedCode 处理失败 其他错误 FailedCode = -1 // SucCode 处理成功 SucCode = 200 // 响应方内部错误 ResponseInternalErr = 5000 // 请求参数错误 RequestParaErr = 1000 // RequestErr 请求方错误 RequestErr = 1001 UnauthorizedErr = 1002 )
View Source
const ( FailedMsg = "failed" SucMsg = "success" )
Variables ¶
This section is empty.
Functions ¶
func CodeJoinMsg ¶ added in v0.0.10
CodeJoinMsg code 对应的 信息和msg进行合拼
func PutCodeMsgMap ¶ added in v0.0.12
PutCodeMsgMap 向codeMsg中设置键值对
Types ¶
type ResultJson ¶
type ResultJson struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
ResultJson 前后端分离开发时 约定好的标准的数据结构
func CommonErrJson ¶ added in v0.0.8
func CommonErrJson(code int, msg string, data ...interface{}) (result *ResultJson)
CommonErrJson 通用的错误返回结构
func CommonJoinMsgErrJson ¶ added in v0.0.12
func CommonJoinMsgErrJson(code int, msg string, data ...interface{}) (result *ResultJson)
CommonJoinMsgErrJson 会对msg就行合拼
func NewResultJson ¶
func NewResultJson(code int, message string, data interface{}) (result *ResultJson)
NewResultJson 构造一个标准的数据
func OtherFailedJson ¶
func OtherFailedJson(msg string, data ...interface{}) (result *ResultJson)
OtherFailedJson 其他错误的错误
func RequestErrJson ¶
func RequestErrJson(msg string, data ...interface{}) (result *ResultJson)
RequestErrJson 请求端错误
func RequestParaErrJson ¶ added in v0.0.8
func RequestParaErrJson(msg string, data ...interface{}) (result *ResultJson)
RequestParaErrJson 请求参数错误
func ResponseInternalErrJson ¶ added in v0.0.5
func ResponseInternalErrJson(msg string, data ...interface{}) (result *ResultJson)
ResponseInternalErrJson 服务端内部错误
func UnauthorizedErrJson ¶ added in v0.0.10
func UnauthorizedErrJson(msg string, data ...interface{}) (result *ResultJson)
RequestParaErrJson 请求参数错误
Click to show internal directories.
Click to hide internal directories.