Documentation
¶
Index ¶
- Constants
- type Error
- type HttpBody
- func ErrorJsonBody(errorCode int) (int, *HttpBody)
- func Fail(code int, message string) (statusCode int, body *HttpBody)
- func JsonBody(data interface{}) (statusCode int, body *HttpBody)
- func Response(status int, code int, message string, data interface{}) (statusCode int, body *HttpBody)
- func Result(code int, message string, data interface{}) (statusCode int, body *HttpBody)
- func Success(data interface{}) (statusCode int, body *HttpBody)
Constants ¶
View Source
const ( SystemError = 1000000 DBError = 1000001 CacheError = 1000002 ThirdServiceError = 1000003 ParamsLost = 1000100 ParamsNotValid = 1000101 ResouceNotExist = 1000102 DataOutOfThreshold = 1000103 FrequentOpration = 1000104 RepeatOpration = 1000105 IllegalRequest = 1000106 DataHasExists = 1000107 PermissionDenied = 1000108 AntiCheating = 1000109 UnsupportClient = 1000110 UnsupportOs = 1000111 AccountFrozen = 1000200 AccountLock = 1000201 TokenError = 1000202 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HttpBody ¶
type HttpBody struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data"` }
HttpBody 是写入http body的json数据结构
func ErrorJsonBody ¶
ErrorJsonBody 生成错误信息的http code和body
func Response ¶
func Response(status int, code int, message string, data interface{}) (statusCode int, body *HttpBody)
Response 通用业务处理
Click to show internal directories.
Click to hide internal directories.