Documentation
¶
Index ¶
- Variables
- func SetDefaultCode(code int)
- func SetDefaultData(data interface{})
- func SetDefaultMsg(msg string)
- type Config
- type Context
- func (c *Context) BindJSONValidator(obj interface{}) error
- 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 GinEngine
- type HookFunc
- type Option
- type Response
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorBind = errors.New("missing required parameters") TraceHeaderKey struct{} )
Functions ¶
Types ¶
type Context ¶
type Context struct {
*gin.Context
// Deprecated
C context.Context
R Response
T *utils.TraceHeader
}
func NewContext ¶
NewContext 初始化上下文包含context.Context 对链路信息进行判断并且在Response时返回TraceId信息
func (*Context) BindJSONValidator ¶ added in v2.1.23
BindJSONValidator 参数绑定结构体,并且按照tag进行校验返回校验结果
func (*Context) BindValidator ¶ added in v2.0.3
BindValidator 参数绑定结构体,并且按照tag进行校验返回校验结果
func (*Context) ErrorCodeMsg ¶ added in v2.0.5
ErrorCodeMsg 直接指定code和msg
type GinEngine ¶ added in v2.1.23
type GinEngine struct {
Gin *gin.Engine
IgnoreReleaseLog bool
// contains filtered or unexported fields
}
func NewGinServer ¶ added in v2.1.23
func (*GinEngine) AddExitHook ¶ added in v2.1.23
添加 GinServer 进程退出时钩子函数
func (*GinEngine) AddShutdownHook ¶ added in v2.1.23
添加 GinServer 服务关闭时的钩子函数
type Option ¶ added in v2.1.23
type Option func(o *Config)
func WithServerDebug ¶ added in v2.1.23
WithServerDebug 设置超时时间
func WithServerHost ¶ added in v2.1.23
WithServerHost 设置host
func WithServerTimeout ¶ added in v2.1.23
WithServerTimeout 设置超时时间
Click to show internal directories.
Click to hide internal directories.