Documentation
¶
Index ¶
- Variables
- func SetDefaultCode(code int)
- func SetDefaultData(data interface{})
- func SetDefaultMsg(msg string)
- type Context
- func (c *Context) BindValidator(obj interface{}) error
- func (c *Context) Error(err error)
- func (c *Context) ErrorCodeMsg(code int, msg string)
- func (c *Context) Response(code int, msg string, data interface{})
- func (c *Context) RetJSON(data interface{}, err error)
- func (c *Context) Success(data interface{})
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorBind = errors.New("missing required parameters") TraceHeaderKey struct{} )
Functions ¶
Types ¶
type Context ¶
func NewContext ¶
NewContext 初始化上下文包含context.Context 对链路信息进行判断并且在Response时返回TraceId信息
func (*Context) BindValidator ¶ added in v2.0.3
BindValidator 参数绑定结构体,并且按照tag进行校验返回校验结果
func (*Context) ErrorCodeMsg ¶ added in v2.0.5
ErrorCodeMsg 直接指定code和msg
Click to show internal directories.
Click to hide internal directories.