Documentation ¶
Index ¶
- type AppConfigInterface
- type ApplicationInterface
- type ApplicationStatus
- type CacheComponentInterface
- type CamModuleType
- type ComponentConfigInterface
- type ComponentInterface
- type ConsoleComponentInterface
- type ContextHttpInterface
- type ContextInterface
- type ControllerActionInterface
- type ControllerInterface
- type DatabaseComponentInterface
- type HttpContextInterface
- type HttpRouteHandler
- type LogLevel
- type MailComponentInterface
- type MessageParseHandler
- type MiddlewareInterface
- type MigrationInterface
- type NextHandler
- type PluginConfigInterface
- type PluginInterface
- type RecoverHandler
- type RecoverHandlerResult
- type RecoverInterface
- type RouteHandler
- type RuleInterface
- type SessionInterface
- type SocketConnHandler
- type SocketRouteHandler
- type ValidHandler
- type ValidInterface
- type ValidMode
- type ValidationComponentInterface
- type WebsocketRouteHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationInterface ¶
type ApplicationInterface interface { // get Component instance by reflect GetComponent(v ComponentInterface) ComponentInterface // get Component instance by component name GetComponentByName(name string) ComponentInterface // get default db component's interface GetDB() DatabaseComponentInterface // run application Run() // stop application Stop() // add migration struct AddMigration(m MigrationInterface) // log trace Trace(title string, content string) // log debug Debug(title string, content string) // log info Info(title string, content string) // log warn Warn(title string, content string) // log error Error(title string, content string) // log fatal Fatal(title string, content string) // Add config AddConfig(config AppConfigInterface) // get value form .evn file GetEvn(key string) string // get params form camAppConfig.Config.Params GetParam(key string) interface{} // get migrate dict GetMigrateDict() map[string]MigrationInterface // get cache component GetCache() CacheComponentInterface // get mail component GetMail() MailComponentInterface // valid struct. Valid(v interface{}) (firstErr error, errDict map[string][]error) }
application interface NODE: Provides interface function to the module inner framework
var App ApplicationInterface
type CacheComponentInterface ¶
type CacheComponentInterface interface { // set cache storage default duration Set(key string, value interface{}) error // set cache storage custom duration SetDuration(key string, value interface{}, duration time.Duration) error // whether the key exists Exists(key string) bool // get value by key Get(key string) interface{} // delete cache Del(keys ...string) error // delete all cache Flush() error }
cache component interface
type ComponentConfigInterface ¶
type ComponentConfigInterface interface { // new component NewComponent() ComponentInterface // get recover handler GetRecoverHandler() RecoverHandler }
component config interface
type ComponentInterface ¶
type ComponentInterface interface { // init Init(configInterface ComponentConfigInterface) // start Start() // stop Stop() // set app instance SetApp(app ApplicationInterface) }
Component interface
type ConsoleComponentInterface ¶
type ConsoleComponentInterface interface { // get database dir GetDatabaseDir() string // get xorm template dir GetXormTemplateDir() string }
console component interface
type ContextHttpInterface ¶ added in v0.4.0
type ContextHttpInterface interface { ContextInterface SetHttpResponseWriter(responseWriter http.ResponseWriter) GetHttpResponseWriter() http.ResponseWriter SetHttpRequest(request *http.Request) GetHttpRequest() *http.Request }
http context it will inject http.ResponseWriter and request *http.Request to context Deprecated: remove on v0.5.0 Instead: HttpContextInterface
type ContextInterface ¶
type ContextInterface interface { // set session SetSession(session SessionInterface) // get session GetSession() SessionInterface // Write returned data Write(res []byte) // Read returned data Read() []byte // Set RecoverInterface. As a error panic by last handle route of handler SetRecover(rec RecoverInterface) // Get RecoverInterface GetRecover() RecoverInterface }
context interface
type ControllerActionInterface ¶
type ControllerActionInterface interface { // controller route Route() string // call action Call() }
controller action interface
type ControllerInterface ¶
type ControllerInterface interface { // init Init() // before action BeforeAction(action ControllerActionInterface) bool // after action AfterAction(action ControllerActionInterface, response []byte) []byte // set context SetContext(context ContextInterface) // get context GetContext() ContextInterface // set session // Deprecated: remove on v0.5.0 // Instead: GetContext().SetSession(); SetSession(session SessionInterface) // get session // Deprecated: remove on v0.5.0 // Instead: GetContext().GetSession(); GetSession() SessionInterface // set values. // it will replace the original values SetValues(values map[string]interface{}) // get default action GetDefaultActionName() string // set response // Deprecated: remove on v0.5.0 // Instead: GetContext().Write(); SetResponse([]byte) // get response // Deprecated: remove on v0.5.0 // Instead: GetContext().Read(); GetResponse() []byte // set recover // Deprecated: remove on v0.5.0 // Instead: GetContext().SetRecover(); SetRecover(rec RecoverInterface) // get recover // Deprecated: remove on v0.5.0 // Instead: GetContext().GetRecover(); GetRecover() RecoverInterface }
controller interface
type DatabaseComponentInterface ¶
type DatabaseComponentInterface interface { // get data source name. // [username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN] GetDSN() string // get engine GetEngine() *xorm.Engine // get xorm session NewSession() *xorm.Session }
database component interface
type HttpContextInterface ¶ added in v0.4.1
type HttpContextInterface interface { ContextInterface SetHttpResponseWriter(responseWriter http.ResponseWriter) GetHttpResponseWriter() http.ResponseWriter SetHttpRequest(request *http.Request) GetHttpRequest() *http.Request CloseHandler(handler func()) Close() }
http context
type HttpRouteHandler ¶
type HttpRouteHandler func(responseWriter http.ResponseWriter, request *http.Request)
http custom route handler
type MailComponentInterface ¶
mail component interface
type MessageParseHandler ¶ added in v0.4.0
type MessageParseHandler func(message []byte) (controllerName string, actionName string, values map[string]interface{})
message parse handler. it can read route and values info form the message
type MiddlewareInterface ¶ added in v0.4.1
type MiddlewareInterface interface { // call when route has middleware Handler(ctx ContextInterface, next NextHandler) []byte }
middleware interface
type MigrationInterface ¶
type MigrationInterface interface { // update migration Up() // recall migration Down() // get up sql list GetSqlList() []string }
migration interface
type NextHandler ¶ added in v0.4.1
type NextHandler func() []byte
the next Handler. The processing method of Middleware
type PluginConfigInterface ¶
type PluginConfigInterface interface {
Init()
}
type PluginInterface ¶
type PluginInterface interface {
Init(configInterface PluginConfigInterface)
}
type RecoverHandler ¶
type RecoverHandler func(rec interface{}) RecoverHandlerResult
component recover handler
type RecoverInterface ¶
recoverable interface
type RouteHandler ¶ added in v0.4.1
type RouteHandler func(ctxI ContextInterface) []byte
route Handler Such as: Custom Handler, ControllerAction Handler
type RuleInterface ¶ added in v0.4.0
type RuleInterface interface { // get fields of validation Fields() []string // get handlers of validation Handlers() []ValidHandler }
rule
type SessionInterface ¶
type SessionInterface interface { // get sessionId GetSessionId() string // set key-value in session Set(key interface{}, value interface{}) // get value by key Get(key interface{}) interface{} // delete value by key Del(key interface{}) // destroy session Destroy() }
session interface
type SocketConnHandler ¶ added in v0.4.0
socket conn handler
type SocketRouteHandler ¶ added in v0.4.0
socket custom route handler
type ValidInterface ¶ added in v0.4.0
type ValidInterface interface { // get rules Rules() []RuleInterface }
valid interface
type ValidationComponentInterface ¶ added in v0.4.0
type ValidationComponentInterface interface { // valid struct Valid(v interface{}) map[string][]error }
validation component interface
type WebsocketRouteHandler ¶
websocket custom route handler