Documentation ¶ Index ¶ Constants func Response(w http.ResponseWriter, resp interface{}, err error) type BaseError func MustBizError(code int, msg string, err error) BaseError func MustDefaultError(err error) BaseError func MustError(msg string, err error) BaseError func (b BaseError) Error() string type Body Constants ¶ View Source const ( BizError = iota + 10001 ParseError MysqlError RedisError TokenError ) Variables ¶ This section is empty. Functions ¶ func Response ¶ func Response(w http.ResponseWriter, resp interface{}, err error) Types ¶ type BaseError ¶ type BaseError struct { Msg string `json:"msg"` //错误信息 Code int `json:"code"` //错误码 Err error } func MustBizError ¶ func MustBizError(code int, msg string, err error) BaseError func MustDefaultError ¶ func MustDefaultError(err error) BaseError func MustError ¶ func MustError(msg string, err error) BaseError func (BaseError) Error ¶ func (b BaseError) Error() string type Body ¶ type Body struct { Code int `json:"code"` Msg string `json:"msg"` Data interface{} `json:"data,omitempty"` } Source Files ¶ View all Source files error.go rest.go Click to show internal directories. Click to hide internal directories.