Documentation ¶
Index ¶
- type BaseContext
- type BaseController
- func (controller *BaseController) AddValue(key string, value interface{})
- func (controller *BaseController) AfterAction(action string, response []byte) []byte
- func (controller *BaseController) BeforeAction(action string) bool
- func (controller *BaseController) GetContext() base.ContextInterface
- func (controller *BaseController) GetValue(key string) interface{}
- func (controller *BaseController) Init()
- func (controller *BaseController) SetContext(context base.ContextInterface)
- func (controller *BaseController) SetHttpValues(w http.ResponseWriter, r *http.Request)
- func (controller *BaseController) SetValues(values map[string]interface{})
- type BaseModel
- type Config
- type Context
- type HttpSession
- type MessageModel
- type ResponseModel
- type WebsocketSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseController ¶ added in v0.0.2
type BaseController struct { base.ControllerInterface // contains filtered or unexported fields }
所有 handler 的基类。主要处理问题是:统一接口、数据库管理
func (*BaseController) AddValue ¶ added in v0.0.2
func (controller *BaseController) AddValue(key string, value interface{})
OVERWRITE: 添加参数
func (*BaseController) AfterAction ¶ added in v0.0.2
func (controller *BaseController) AfterAction(action string, response []byte) []byte
执行动作后执行的方法 过滤返回结果
func (*BaseController) BeforeAction ¶ added in v0.0.2
func (controller *BaseController) BeforeAction(action string) bool
执行动作前执行的方法 如果返回 false 将会返回一个错误
func (*BaseController) GetContext ¶ added in v0.0.2
func (controller *BaseController) GetContext() base.ContextInterface
获取上下文对象
func (*BaseController) GetValue ¶ added in v0.0.2
func (controller *BaseController) GetValue(key string) interface{}
获取参数
func (*BaseController) SetContext ¶ added in v0.0.2
func (controller *BaseController) SetContext(context base.ContextInterface)
设置上下文对象
func (*BaseController) SetHttpValues ¶ added in v0.0.2
func (controller *BaseController) SetHttpValues(w http.ResponseWriter, r *http.Request)
设置http接收到的参数
func (*BaseController) SetValues ¶ added in v0.0.2
func (controller *BaseController) SetValues(values map[string]interface{})
设置接收到的参数
type Config ¶
type Config struct { BaseModel Params map[string]interface{} // 参数。自定义的配置参数 ComponentDict map[string]base.ConfigComponentInterface // 组件。组件名 => 配置 }
配置实例。用于封装配置
type Context ¶ added in v0.0.2
type Context struct { BaseContext // contains filtered or unexported fields }
http 上下文对象
func NewContext ¶ added in v0.0.2
func NewContext(session base.SessionInterface) *Context
新建 http 上下文对象
func (*Context) GetSession ¶ added in v0.0.2
func (model *Context) GetSession() base.SessionInterface
获取session
type HttpSession ¶ added in v0.0.2
type HttpSession struct { base.SessionInterface // contains filtered or unexported fields }
session
func NewHttpSession ¶ added in v0.0.2
func NewHttpSession(session *sessions.Session) *HttpSession
func (*HttpSession) Destroy ¶ added in v0.0.2
func (model *HttpSession) Destroy()
销毁session 清空 session 所有数据
func (*HttpSession) Get ¶ added in v0.0.2
func (model *HttpSession) Get(key interface{}) interface{}
获取值
func (*HttpSession) GetSessionId ¶ added in v0.0.2
func (model *HttpSession) GetSessionId() string
获取 sessionId
func (*HttpSession) Set ¶ added in v0.0.2
func (model *HttpSession) Set(key interface{}, value interface{})
设置值
type MessageModel ¶ added in v0.0.2
type ResponseModel ¶ added in v0.0.2
type WebsocketSession ¶
type WebsocketSession struct { BaseModel // contains filtered or unexported fields }
websocket 使用的 session 。没有发送的功能。必须依赖 WebsocketServer 进行发送
func NewWebsocketSession ¶
func NewWebsocketSession(conn *websocket.Conn) *WebsocketSession
新建websocket session
func (*WebsocketSession) Destroy ¶ added in v0.0.2
func (model *WebsocketSession) Destroy()
销毁session 清空 session 所有数据
func (*WebsocketSession) Get ¶ added in v0.0.2
func (model *WebsocketSession) Get(key interface{}) interface{}
获取值
func (*WebsocketSession) GetSessionId ¶ added in v0.0.2
func (model *WebsocketSession) GetSessionId() string
获取 sessionId
func (*WebsocketSession) Set ¶ added in v0.0.2
func (model *WebsocketSession) Set(key interface{}, value interface{})
设置值
Click to show internal directories.
Click to hide internal directories.