Documentation
¶
Index ¶
- Variables
- func RecoveryHandler(c *gin.Context)
- func TranGinHandlerFunc2Interface(datas []gin.HandlerFunc) []interface{}
- type GinBox
- func (g *GinBox) HTTPRouter(irouter IGinBoxRouter) error
- func (g *GinBox) Handle(name, method, relativePath string, handlers ...gin.HandlerFunc) error
- func (g *GinBox) Init(configs []*ServerConfig, middleware ...gin.HandlerFunc) error
- func (g *GinBox) Run() error
- func (g *GinBox) Server(names ...string) *GinServer
- func (g *GinBox) Stop() error
- type GinServer
- func (g *GinServer) Engine() *gin.Engine
- func (g *GinServer) Handle(method, relativePath string, handlers ...gin.HandlerFunc) error
- func (g *GinServer) Init(conf *ServerConfig, middleware ...gin.HandlerFunc) error
- func (g *GinServer) Route(method, relativePath string, routes ...interface{}) error
- func (g *GinServer) Run() error
- func (g *GinServer) Stop() error
- type IGinBoxRouter
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultMiddlewares = []gin.HandlerFunc{middleware.Trace(), middleware.Recovery(RecoveryHandler), middleware.Cors()}
DefaultMiddlewares ...
Functions ¶
func TranGinHandlerFunc2Interface ¶
func TranGinHandlerFunc2Interface(datas []gin.HandlerFunc) []interface{}
TranGinHandlerFunc2Interface ...
Types ¶
type GinBox ¶
type GinBox struct {
// contains filtered or unexported fields
}
GinBox GinBox 对象
func (*GinBox) HTTPRouter ¶
func (g *GinBox) HTTPRouter(irouter IGinBoxRouter) error
HTTPRouter regist a http router
func (*GinBox) Handle ¶
func (g *GinBox) Handle(name, method, relativePath string, handlers ...gin.HandlerFunc) error
Handle 根据参数处理server的route相关
func (*GinBox) Init ¶
func (g *GinBox) Init(configs []*ServerConfig, middleware ...gin.HandlerFunc) error
Init 初始化默认的全局GinServerBox对象
type GinServer ¶
type GinServer struct { ServerConfig // contains filtered or unexported fields }
GinServer GinServer 对象
func NewGinServer ¶
func NewGinServer(middleware ...gin.HandlerFunc) *GinServer
NewGinServer 快速的根据配置生成gin server 初始化时, 可以制定一些中间件作为 gin sever 的通用中间件 返回 GinServer 对象指针
func (*GinServer) Handle ¶
func (g *GinServer) Handle(method, relativePath string, handlers ...gin.HandlerFunc) error
Handle 根据参数处理server的route相关
func (*GinServer) Init ¶
func (g *GinServer) Init(conf *ServerConfig, middleware ...gin.HandlerFunc) error
Init 根据参数生成一个gin.Engine
type IGinBoxRouter ¶
IGinBoxRouter interface for gins's router
type ServerConfig ¶
type ServerConfig = base.ServiceConfig
Click to show internal directories.
Click to hide internal directories.