Documentation ¶
Index ¶
- Variables
- func Register(code Code, text string, httpCodes ...int)
- type Code
- type CodeMap
- func (s CodeMap) Get(code Code) TextHTTPCode
- func (s CodeMap) GetByInt(code int) TextHTTPCode
- func (s CodeMap) Set(code Code, text string, httpCodes ...int) CodeMap
- func (s CodeMap) SetHTTPCodeToExists(code Code, httpCode int) CodeMap
- func (s CodeMap) SetToExists(code Code, text string, httpCodes ...int) CodeMap
- type TextHTTPCode
Constants ¶
This section is empty.
Variables ¶
View Source
var CodeDict = CodeMap{ SystemUnauthorized: {"SystemUnauthorized", http.StatusServiceUnavailable}, SystemNotInstalled: {"SystemNotInstalled", http.StatusServiceUnavailable}, OperationProcessing: {"OperationProcessing", http.StatusProcessing}, FrequencyTooFast: {"FrequencyTooFast", http.StatusTooManyRequests}, RequestFailure: {"RequestFailure", http.StatusBadRequest}, RequestTimeout: {"RequestTimeout", http.StatusRequestTimeout}, AbnormalResponse: {"AbnormalResponse", http.StatusInternalServerError}, OperationTimeout: {"OperationTimeout", http.StatusRequestTimeout}, Unsupported: {"Unsupported", http.StatusNotImplemented}, RepeatOperation: {"RepeatOperation", http.StatusBadRequest}, InvalidAppID: {"InvalidAppID", http.StatusBadRequest}, InvalidToken: {"InvalidToken", http.StatusBadRequest}, DataSizeTooBig: {"DataSizeTooBig", http.StatusRequestEntityTooLarge}, DataAlreadyExists: {"DataAlreadyExists", http.StatusBadRequest}, DataFormatIncorrect: {"DataFormatIncorrect", http.StatusBadRequest}, DataStatusIncorrect: {"DataStatusIncorrect", http.StatusBadRequest}, DataHasExpired: {"DataHasExpired", http.StatusBadRequest}, DataProcessing: {"DataProcessing", http.StatusProcessing}, DataUnavailable: {"DataUnavailable", http.StatusBadRequest}, InvalidType: {"InvalidType", http.StatusBadRequest}, InvalidSignature: {"InvalidSignature", http.StatusBadRequest}, InvalidParameter: {"InvalidParameter", http.StatusBadRequest}, DataNotFound: {"DataNotFound", http.StatusNotFound}, CaptchaCodeRequired: {"CaptchaCodeRequired", http.StatusBadRequest}, CaptchaIdMissing: {"CaptchaIdMissing", http.StatusBadRequest}, CaptchaError: {"CaptchaError", http.StatusBadRequest}, BalanceNoEnough: {"BalanceNoEnough", http.StatusPreconditionFailed}, UserDisabled: {"UserDisabled", http.StatusBadRequest}, UserNotFound: {"UserNotFound", http.StatusBadRequest}, NonPrivileged: {"NonPrivileged", http.StatusForbidden}, Unauthenticated: {"Unauthenticated", http.StatusUnauthorized}, Failure: {"Failure", http.StatusInternalServerError}, Success: {"Success", http.StatusOK}, }
CodeDict 状态码字典
Functions ¶
Types ¶
type Code ¶
type Code int
const ( SystemNotInstalled Code = -300 // 系统未安装 FrequencyTooFast Code = -207 //操作频率太快 OperationProcessing Code = -206 //操作处理中 RequestFailure Code = -205 //提交失败 RequestTimeout Code = -204 //提交超时 AbnormalResponse Code = -203 //响应异常 OperationTimeout Code = -202 //操作超时 Unsupported Code = -201 //不支持的操作 RepeatOperation Code = -200 //重复操作 InvalidToken Code = -151 //令牌错误 InvalidAppID Code = -150 //AppID不正确 DataSizeTooBig Code = -110 //数据尺寸太大 DataAlreadyExists Code = -109 //数据已经存在 DataFormatIncorrect Code = -108 //数据格式不正确 DataStatusIncorrect Code = -107 //数据状态不正确 DataProcessing Code = -106 //数据未处理中状态 DataHasExpired Code = -104 //数据已经过期 InvalidType Code = -103 //类型不正确 InvalidSignature Code = -102 //无效的签名 InvalidParameter Code = -101 //无效的参数 DataNotFound Code = -100 //数据未找到 CaptchaCodeRequired Code = -11 // captcha code 不能为空 CaptchaIdMissing Code = -10 // 缺少captchaId CaptchaError Code = -9 //验证码错误 BalanceNoEnough Code = -5 //余额不足 UserDisabled Code = -4 //用户被禁用 UserNotFound Code = -3 //用户未找到 NonPrivileged Code = -2 //无权限 Unauthenticated Code = -1 //未登录 Failure Code = 0 //操作失败 Success Code = 1 //操作成功 )
type CodeMap ¶
type CodeMap map[Code]TextHTTPCode
func (CodeMap) Get ¶
func (s CodeMap) Get(code Code) TextHTTPCode
func (CodeMap) GetByInt ¶
func (s CodeMap) GetByInt(code int) TextHTTPCode
func (CodeMap) SetHTTPCodeToExists ¶
type TextHTTPCode ¶
func Get ¶
func Get(code Code) TextHTTPCode
Click to show internal directories.
Click to hide internal directories.