Documentation
¶
Index ¶
- func CommonContext(c *gin.Context) context.Context
- func EditableContext(c *gin.Context) lang.Context
- func GinContext(cc context.Context) *gin.Context
- type Connector
- type Container
- type ContentTypeManager
- type Controller
- type DefaultContentTypeManager
- type DefaultRestController
- type EngineConnection
- type ErrorController
- 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】
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 Controller ¶
type Controller interface {
Init(ec EngineConnection) error
}
Controller 接口表示一个gin-glass控制器
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 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
- 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
Click to show internal directories.
Click to hide internal directories.