Documentation
¶
Index ¶
- func CommonContext(c *gin.Context) context.Context
- func EditableContext(c *gin.Context) lang.Context
- func GinContext(cc context.Context) *gin.Context
- func WebApplicationContext(c *gin.Context) (application.Context, error)
- type Connector
- type Container
- type ContentTypeManager
- type ContextBindController
- type Controller
- type ControllerFunc
- type DefaultContentTypeManager
- type DefaultRestController
- type EngineConnection
- type ErrorController
- type GroupController
- type HTTPConnector
- type HTTPSConnector
- type LocalFileSystemController
- type Server
- type StaticWebResourcesController
- type WebContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonContext ¶
CommonContext 函数把【*gin.Context】转换成【context.Context】
func EditableContext ¶
EditableContext 函数把【*gin.Context】转换成【lang.Context】
func GinContext ¶
GinContext 函数把【context.Context】转换成【*gin.Context】
func WebApplicationContext ¶ added in v0.0.18
func WebApplicationContext(c *gin.Context) (application.Context, error)
WebApplicationContext 函数把【*gin.Context】转换成【application.Context】
Types ¶
type Connector ¶
type Connector interface {
// 打开连接
Open() (EngineConnection, error)
}
Connector 是服务连接器的接口
type Container ¶
type Container struct {
Name string
Server *Server
Connectors []Connector
Services []*WebContext
ContentTypes ContentTypeManager
IndexPages string
AppContext application.Context
// contains filtered or unexported fields
}
Container 表示一个web容器(gin-glass)
type ContentTypeManager ¶
type ContextBindController ¶ added in v0.0.18
type ContextBindController struct {
AppContext application.Context
}
ContextBindController 控制器把 application.Context 绑定到 gin.Context
func (*ContextBindController) Init ¶ added in v0.0.18
func (inst *ContextBindController) Init(ec EngineConnection) error
Init 初始化控制器
type Controller ¶
type Controller interface {
Init(ec EngineConnection) error
}
Controller 接口表示一个gin-glass控制器
type ControllerFunc ¶ added in v0.0.14
type ControllerFunc func(ec EngineConnection) error
ControllerFunc 提供一个面向函数的控制器接口
type DefaultContentTypeManager ¶
type DefaultContentTypeManager struct {
AppContext application.Context
TypesProperties string
// contains filtered or unexported fields
}
func (*DefaultContentTypeManager) Find ¶
func (inst *DefaultContentTypeManager) Find(name string) string
Find 根据文件名查找相应的content-type
type DefaultRestController ¶
type DefaultRestController struct {
}
type EngineConnection ¶
type EngineConnection interface {
io.Closer // 用于关闭连接
// 等待工作者循环退出
Join() error
// 运行工作者循环
Run() error
// 映射到新的路径
RequestMapping(path string) EngineConnection
// 注册过滤器
Filter(order int, handler gin.HandlerFunc)
// 注册处理器
Handle(method string, path string, handler gin.HandlerFunc)
// 注册 error 处理器
HandleNoMethod(handler gin.HandlerFunc)
// 注册 error 处理器
HandleNoResource(handler gin.HandlerFunc)
}
EngineConnection 表示与gin.Engine 之间的连接
type ErrorController ¶
type ErrorController struct {
// public
ResourcePath string
ContentType string
Status int
Container *Container
// contains filtered or unexported fields
}
func (*ErrorController) Init ¶
func (inst *ErrorController) Init(ec EngineConnection) error
type GroupController ¶ added in v0.0.14
type GroupController struct {
// contains filtered or unexported fields
}
GroupController 将一组 ControllerFunc 封装成一个 Controller 对象
func (*GroupController) AddController ¶ added in v0.0.14
func (inst *GroupController) AddController(ctr Controller)
AddController 添加一个 Controller 到group
func (*GroupController) AddFunction ¶ added in v0.0.14
func (inst *GroupController) AddFunction(fn ControllerFunc)
AddFunction 添加一个func到group
func (*GroupController) Init ¶ added in v0.0.14
func (inst *GroupController) Init(ec EngineConnection) error
Init 初始化
type HTTPConnector ¶
HTTPConnector 是一个基本的http连接器,提供不加密的http服务
type HTTPSConnector ¶
type HTTPSConnector struct {
Host string
Port int
Enable bool
GinMode string
CertificateFile string
PrivateKeyFile string
}
HTTPSConnector 是一个加密的https连接器,提供安全的https服务
func (*HTTPSConnector) Open ¶
func (inst *HTTPSConnector) Open() (EngineConnection, error)
Open 打开连接
type LocalFileSystemController ¶
type LocalFileSystemController struct {
}
type StaticWebResourcesController ¶
type StaticWebResourcesController struct {
Root string // 这是一个资源路径,指向 static-www 文件夹 `inject:"${web.static.root}"`
Container *Container `inject:"#gin-web-container"`
}
func (*StaticWebResourcesController) Init ¶
func (inst *StaticWebResourcesController) Init(ec EngineConnection) error
type WebContext ¶
type WebContext struct {
Container *Container
ContextPath string
Controllers []Controller
}
WebContext 表示一个web上下文(service)
func (*WebContext) MainController ¶
func (inst *WebContext) MainController() Controller
MainController 取上下文的主控制器
Source Files
¶
- connector.go
- container.go
- content_types.go
- context_adapter.go
- context_bind_controller.go
- controller.go
- error_controller.go
- gin_engine_agent.go
- gin_engine_mock.go
- http_connector.go
- https_connector.go
- local_filesystem_controller.go
- rest_api_controller.go
- server.go
- server_runtime.go
- static_res_controller.go
- web_context.go
- web_filter_registration.go
- web_handler_registration.go