camBase

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfigInterface

type AppConfigInterface interface {
}

app config interface

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
}

application interface NODE: Provides interface function to the module inner framework

type ApplicationStatus

type ApplicationStatus int

app status

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 CamModuleType

type CamModuleType int

CamModule type

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 ContextInterface

type ContextInterface interface {
}

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
	SetSession(session SessionInterface)
	// get session
	GetSession() SessionInterface
	// set values.
	// it will replace the original values
	SetValues(values map[string]interface{})
	// get default action
	GetDefaultActionName() string
	// set response
	SetResponse([]byte)
	// get response
	GetResponse() []byte
	// set recover
	SetRecover(rec RecoverInterface)
	// get recover
	GetRecover() RecoverInterface
}

controller interface

type DatabaseComponentInterface

type DatabaseComponentInterface interface {
	// get data source name.
	// [username[:password]@][protocol[(address)]]/dbname[?param1=value1&...&paramN=valueN]
	GetDSN() string
	// get engine
	GetEngine() *xorm.Engine
	// get xorm session
	NewSession() *xorm.Session
}

database component interface

type HttpRouteHandler

type HttpRouteHandler func(responseWriter http.ResponseWriter, request *http.Request)

http custom route handler

type LogLevel

type LogLevel uint8

log level

type MailComponentInterface

type MailComponentInterface interface {
	Send(subject string, body string, to ...string) error
}

mail component interface

type MigrationInterface

type MigrationInterface interface {
	// update migration
	Up()
	// recall migration
	Down()
	// get up sql list
	GetSqlList() []string
}

migration interface

type PluginConfigInterface

type PluginConfigInterface interface {
	Init()
}

type PluginInterface

type PluginInterface interface {
	Init(configInterface PluginConfigInterface)
}

type Recover

type Recover struct {
	RecoverInterface
	// contains filtered or unexported fields
}

recoverable panic content

func NewRecoverable

func NewRecoverable(message string) *Recover

new recoverable

func (*Recover) Error

func (r *Recover) Error() string

get error string

func (*Recover) GetError

func (r *Recover) GetError() error

get error

type RecoverHandler

type RecoverHandler func(rec interface{}) RecoverHandlerResult

component recover handler

type RecoverHandlerResult

type RecoverHandlerResult uint8

recover handler result

type RecoverInterface

type RecoverInterface interface {
	Error() string
	GetError() error
}

recoverable interface

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{}
	// destroy session
	Destroy()
}

session interface

type WebsocketMessageParseHandler

type WebsocketMessageParseHandler func(message []byte) (controllerName string, actionName string, values map[string]interface{})

websocket component message parse handler

type WebsocketRouteHandler

type WebsocketRouteHandler func(conn *websocket.Conn) []byte

websocket custom route handler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL