Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SuccessResponse success response SuccessResponse = Response{Code: 1000, Message: "success"} // ErrInternalServer server internal ErrInternalServer = Response{Code: 1001, Message: "系统错误"} // ErrMissParams params miss ErrMissParams = Response{Code: 1002, Message: "缺少参数"} // ErrFailParams params fail ErrFailParams = Response{Code: 1003, Message: "参数格式错误"} // ErrNotExist record not find ErrNotExist = Response{Code: 1004, Message: "数据不存在"} )
View Source
var BuildTime string
BuildTime build in time
View Source
var BuildVersion string
BuildVersion build in git last commit id
Functions ¶
Types ¶
type Response ¶
type Response struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
Response response struct
func NewErrMessageResponse ¶
NewErrMessageResponse new error message
func NewErrResponse ¶
NewErrResponse new error response
func NewResponseWithData ¶
NewResponseWithData 返回携带data的自定义响应
func NewSucResponse ¶
func NewSucResponse(data interface{}) Response
NewSucResponse new success data