Documentation
¶
Index ¶
- Constants
- Variables
- func Err(statusCode int) (e error)
- func Get(statusCode int) (int, error)
- func GetStatusMsg(statusCode int) (s string)
- func New(retStatusMap map[int]GroupRetStatusCode) error
- func Override(retStatusMap map[int]GroupRetStatusCode)
- type BaseRequest
- type BaseResponse
- type GameBaseRequest
- type GameRetStatus
- type GroupRetStatusCode
- type RetStatus
- func (retStatus *RetStatus) Err() (e error)
- func (r RetStatus) Error() string
- func (retStatus *RetStatus) Is(retStatusCode int) bool
- func (retStatus *RetStatus) IsSuccess() bool
- func (r RetStatus) MarshalJSON() ([]byte, error)
- func (retStatus *RetStatus) SetSuccess()
- func (retStatus *RetStatus) Update(statusCode int)
Constants ¶
View Source
const ( Mysql = 3300 // Mysql基礎號段 Mysql_InvalidInput = 3301 // 無效參數 Mysql_ResourceNotFound = 3302 // 資源不存在 Mysql_Unknown = 3303 // 未知錯誤 Mysql_InternalServiceError = 3304 // 內部服務錯誤 Mysql_ExternalServiceError = 3305 // 外部服務錯誤 )
View Source
const CreatedSuccess = 10001 // Success : 新增成功返回
View Source
const DeletedSuccess = 10003 // Success : 刪除成功返回
View Source
const Success = 10000 // Success : 正常返回
View Source
const UnknownStatusCode = "Unknown Status Code"
UnknownStatusCode : 未知代碼(可能未宣告const或map)
View Source
const UpdatedSuccess = 10002 // Success : 更新成功返回
Variables ¶
View Source
var ErrKeyConflict = errors.New("key conflict")
ErrKeyConflict : retStatusCode衝突
View Source
var ErrKeyOutOfRange = errors.New("key out of range")
ErrKeyOutOfRange : retStatusCode 超出可自訂範圍(自訂範圍為6位數)
Functions ¶
func GetStatusMsg ¶
GetStatusMsg : 將 statusCode 轉為 error msg
Types ¶
type BaseRequest ¶
type BaseRequest struct { BaseUrl string `json:"baseUrl"` BaseSendTime int64 `json:"baseSendTime"` BaseScgToken string `json:"baseScgToken"` MemberId string `json:"memberId"` }
後台端
type BaseResponse ¶
type BaseResponse struct {
RetStatus RetStatus `json:"retStatus"`
}
BaseResponse : 基礎回應資料結構
func (BaseResponse) Error ¶
func (b BaseResponse) Error() string
type GameBaseRequest ¶
type GameBaseRequest struct { BaseUrl string `json:"BaseUrl"` BaseSendTime int64 `json:"BaseSendTime"` BaseScgToken string `json:"BaseScgToken"` MemberId string `json:"MemberId"` }
Game端
type GameRetStatus ¶
type GameRetStatus struct { StatusCode int `json:"StatusCode" qs:"StatusCode"` StatusMsg string `json:"StatusMsg" qs:"StatusMsg"` SystemTime int64 `json:"SystemTime" qs:"SystemTime"` CheckCode int `json:"CheckCode" qs:"CheckCode"` }
Game端
func CreateGame ¶
func CreateGame(statusCode int) (retStatus *GameRetStatus)
CreateGame : 新增retStatus :後台端
type GroupRetStatusCode ¶
type RetStatus ¶
type RetStatus struct { StatusCode int `json:"statusCode" qs:"statusCode"` StatusMsg string `json:"statusMsg" qs:"statusMsg"` SystemTime int64 `json:"systemTime" qs:"systemTime"` CheckCode int `json:"checkCode" qs:"checkCode"` }
後台端
func CreateSuccess ¶
func CreateSuccess() (retStatus *RetStatus)
CreateSuccess : 建立一個 Success 的 RetStatus
func (RetStatus) MarshalJSON ¶
Click to show internal directories.
Click to hide internal directories.