Documentation
¶
Index ¶
- func GetHttpErrCodeMsg(err error) (uint32, string)
- func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err error)
- func HttpStatusResult(r *http.Request, w http.ResponseWriter, statusCode int, err error)
- func MapErrorResult(r *http.Request, w http.ResponseWriter, code uint32, msg string)
- func MdErrorResult(r *http.Request, w http.ResponseWriter, msg string)
- func ParamErrorResult(r *http.Request, w http.ResponseWriter, err error)
- type NullJson
- type ResponseErrorBean
- type ResponseSuccessBean
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHttpErrCodeMsg ¶
func HttpResult ¶
func HttpResult(r *http.Request, w http.ResponseWriter, resp interface{}, err error)
HttpResult http返回结果
func HttpStatusResult ¶
HttpStatusResult 返回自定义httpStatus状态码错误
func MapErrorResult ¶
MapErrorResult 自定义返回code和msg
func MdErrorResult ¶
func MdErrorResult(r *http.Request, w http.ResponseWriter, msg string)
MdErrorResult 定义中间件错误
func ParamErrorResult ¶
func ParamErrorResult(r *http.Request, w http.ResponseWriter, err error)
ParamErrorResult http 参数错误返回
Types ¶
type ResponseErrorBean ¶
type ResponseSuccessBean ¶
type ResponseSuccessBean struct { Code uint32 `json:"code"` // 业务状态码 Msg string `json:"msg"` // 业务消息 Data interface{} `json:"data"` // 返回数据 TraceId string `json:"traceId"` // 链路跟踪traceId SpanId string `json:"spanId"` // 链路跟踪spanId }
func Success ¶
func Success(traceId, spanId string, data interface{}) *ResponseSuccessBean
Success 请求成功返回数据, traceId 为链路跟踪traceId, spanId为链路跟踪spanId
Click to show internal directories.
Click to hide internal directories.