Documentation
¶
Index ¶
Constants ¶
View Source
const ( SuccCode = 0 // succeed ParamsParseErr = 2001 ParamsMissingErr = 2002 ParamsInvalidErr = 2003 InternalServerErr = 2010 )
common error code
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommonResponse ¶
type CommonResponse struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data"` }
CommonResponse common rest response
func ErrorResponse ¶
func ErrorResponse(errCode int, msg string) *CommonResponse
ErrorResponse generate error response Param code: error code Param msg: additional messages for the error, can be nil
func SuccessResponse ¶
func SuccessResponse(data interface{}) *CommonResponse
SuccessResponse generate success response
Click to show internal directories.
Click to hide internal directories.