Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseConfig ¶
type BaseConfig struct {
base.ConfigComponentInterface
Component base.ComponentInterface // 需要初始化的组件实例
}
基础配置
func (*BaseConfig) GetComponent ¶
func (config *BaseConfig) GetComponent() base.ComponentInterface
获取配置需要初始化的组件
type Database ¶ added in v0.0.2
type Database struct {
BaseConfig
// 驱动名字
DriverName string
// 地址
Host string
// 端口
Port string
// 数据库名字
Name string
// 用户名
Username string
// 密码
Password string
// 数据库迁移文件路径
MigrateDir string
}
数据库配置
func (*Database) SetMigrateDir ¶ added in v0.0.2
设置 migrate 路径
type HttpServer ¶
type HttpServer struct {
BaseConfig
PluginRouter
Port uint16
SessionName string
SessionKey string
}
http 服务
func (*HttpServer) SetSessionKey ¶ added in v0.0.2
func (config *HttpServer) SetSessionKey(sessionKey string) *HttpServer
设置 session key
func (*HttpServer) SetSessionName ¶ added in v0.0.2
func (config *HttpServer) SetSessionName(sessionName string) *HttpServer
设置session name
type PluginRouter ¶
type PluginRouter struct {
// http 或 websocket 控制器列表
ControllerList []base.ControllerInterface
// 控制台 控制器列表
ConsoleControllerList []base.ControllerInterface
// websocket 接收到参数执行的方法
OnWebsocketMessageHandler func(conn *models.Context, recvMessage []byte)
}
路由插件。添加这个插件后的配置可获取路由的参数
type WebsocketServer ¶
type WebsocketServer struct {
BaseConfig
PluginRouter
Port uint16 // 服务器端口
// 传输消息解析器
// message: 客户端发送过来的消息
// controllerName: 控制器名字
// actionName: 控制器方法名字
// values: 传输的参数
MessageParseHandler func(message []byte) (controllerName string, actionName string, values map[string]interface{})
}
websocket server 所需的配置
Click to show internal directories.
Click to hide internal directories.