Documentation
¶
Index ¶
- type AppConfig
- 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) GetAppInterface() camBase.ApplicationInterface
- func (controller *BaseController) GetContext() camBase.ContextInterface
- func (controller *BaseController) GetValue(key string) interface{}
- func (controller *BaseController) Init()
- func (controller *BaseController) Read() []byte
- func (controller *BaseController) SetApp(app camBase.ApplicationInterface)
- func (controller *BaseController) SetContext(context camBase.ContextInterface)
- func (controller *BaseController) SetHttpValues(w http.ResponseWriter, r *http.Request)
- func (controller *BaseController) SetValues(values map[string]interface{})
- func (controller *BaseController) Write(bytes []byte)
- type BaseModel
- type Cam
- type CamModule
- type Config
- type Context
- type HttpSession
- type MessageModel
- type Migration
- type ResponseModel
- type WebsocketSession
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppConfig ¶
type AppConfig struct {
// The component name of the default components.Database
DefaultDBName string
// default xorm template's file relative path.
DefaultTemplatesDir string
}
application's config struct
type BaseContext ¶
type BaseContext struct {
camBase.ContextInterface
// contains filtered or unexported fields
}
上下文对象
func (*BaseContext) GetSession ¶ added in v0.2.15
func (model *BaseContext) GetSession() camBase.SessionInterface
func (*BaseContext) SetSession ¶ added in v0.2.15
func (model *BaseContext) SetSession(session camBase.SessionInterface)
type BaseController ¶
type BaseController struct {
camBase.ControllerInterface
// contains filtered or unexported fields
}
所有 handler 的基类。主要处理问题是:统一接口、数据库管理
func (*BaseController) AddValue ¶
func (controller *BaseController) AddValue(key string, value interface{})
OVERWRITE: 添加参数
func (*BaseController) AfterAction ¶
func (controller *BaseController) AfterAction(action string, response []byte) []byte
执行动作后执行的方法 过滤返回结果
func (*BaseController) BeforeAction ¶
func (controller *BaseController) BeforeAction(action string) bool
执行动作前执行的方法 如果返回 false 将会返回一个错误
func (*BaseController) GetAppInterface ¶
func (controller *BaseController) GetAppInterface() camBase.ApplicationInterface
Return app instance
func (*BaseController) GetContext ¶
func (controller *BaseController) GetContext() camBase.ContextInterface
获取上下文对象
func (*BaseController) GetValue ¶
func (controller *BaseController) GetValue(key string) interface{}
获取参数
func (*BaseController) SetApp ¶
func (controller *BaseController) SetApp(app camBase.ApplicationInterface)
set app instance
func (*BaseController) SetContext ¶
func (controller *BaseController) SetContext(context camBase.ContextInterface)
设置上下文对象
func (*BaseController) SetHttpValues ¶
func (controller *BaseController) SetHttpValues(w http.ResponseWriter, r *http.Request)
设置http接收到的参数
func (*BaseController) SetValues ¶
func (controller *BaseController) SetValues(values map[string]interface{})
设置接收到的参数
func (*BaseController) Write ¶
func (controller *BaseController) Write(bytes []byte)
set response str
type CamModule ¶ added in v0.2.9
type CamModule struct {
Name string `json:"name"`
Type camBase.CamModuleType `json:"type"`
}
type Config ¶
type Config struct {
BaseModel
// Application config
AppConfig *AppConfig
// Params required by the business logic
Params map[string]interface{}
// Components's config
ComponentDict map[string]camBase.ConfigComponentInterface
}
config struct config can merge in application
type Context ¶
type Context struct {
BaseContext
// contains filtered or unexported fields
}
http 上下文对象
type HttpSession ¶
type HttpSession struct {
camBase.SessionInterface
// contains filtered or unexported fields
}
session
func NewHttpSession ¶
func NewHttpSession(session *sessions.Session) *HttpSession
type MessageModel ¶
type Migration ¶
type Migration struct {
camBase.MigrationInterface
// contains filtered or unexported fields
}
base migration struct
type ResponseModel ¶
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 ¶
func (model *WebsocketSession) Destroy()
销毁session 清空 session 所有数据
func (*WebsocketSession) GetConn ¶ added in v0.2.13
func (model *WebsocketSession) GetConn() *websocket.Conn
get client connection
func (*WebsocketSession) GetSessionId ¶
func (model *WebsocketSession) GetSessionId() string
获取 sessionId
func (*WebsocketSession) Set ¶
func (model *WebsocketSession) Set(key interface{}, value interface{})
设置值
Source Files
¶
Click to show internal directories.
Click to hide internal directories.