Documentation
¶
Index ¶
- Constants
- Variables
- func AddComponent(name string, conf camBase.ComponentConfigInterface)
- func Debug(title, content string)
- func Env(key string) string
- func Error(title, content string)
- func Fatal(title, content string)
- func Info(title, content string)
- func NewAppConfig() *camConfig.AppConfig
- func NewCacheConfig() *camCache.CacheComponentConfig
- func NewConfig() *camConfig.Config
- func NewConsoleConfig() *camConsole.ConsoleComponentConfig
- func NewDatabaseConfig(driverName string, host string, port string, name string, username string, ...) *camDatabase.DatabaseComponentConfig
- func NewFileCache() *camCache.FileCache
- func NewHttpConfig(port uint16) *camHttp.HttpComponentConfig
- func NewLogConfig() *camLog.LogComponentConfig
- func NewMailConfig(email string, password string, host string) *camMail.MailComponentConfig
- func NewRecover(message string) *camStructs.Recover
- func NewRedisCache() *camCache.RedisCache
- func NewRule(fields []string, handlers ...camBase.ValidHandler) *camStructs.Rule
- func NewSocketConfig(port uint16) *camSocket.SocketComponentConfig
- func NewTemplateCommand() *template.Command
- func NewValidationConfig() *camValidation.ValidationComponentConfig
- func NewWebsocketConfig(port uint16) *camWebsocket.WebsocketComponentConfig
- func Param(key string) interface{}
- func RegisterController(ctrl camBase.ControllerInterface)
- func RunDefault()
- func Trace(title, content string)
- func Valid(v interface{}) (firstErr error, errDict map[string][]error)
- func Warn(title, content string)
- type Application
- func (app *Application) AddComponentAfterRun(name string, conf camBase.ComponentConfigInterface) camBase.ComponentInterface
- func (app *Application) AddConfig(configI camBase.AppConfigInterface)
- func (app *Application) AddMigration(m camBase.MigrationInterface)
- func (app *Application) Debug(title string, content string)
- func (app *Application) Error(title string, content string)
- func (app *Application) Fatal(title string, content string)
- func (app *Application) GetCache() camBase.CacheComponentInterface
- func (app *Application) GetComponent(v camBase.ComponentInterface) camBase.ComponentInterface
- func (app *Application) GetComponentByName(name string) camBase.ComponentInterface
- func (app *Application) GetDB() camBase.DatabaseComponentInterface
- func (app *Application) GetEvn(key string) string
- func (app *Application) GetMail() camBase.MailComponentInterface
- func (app *Application) GetMigrateDict() map[string]camBase.MigrationInterface
- func (app *Application) GetParam(key string) interface{}
- func (app *Application) Info(title string, content string)
- func (app *Application) Run()
- func (app *Application) Stop()
- func (app *Application) Trace(title string, content string)
- func (app *Application) Valid(v interface{}) (firstErr error, errDict map[string][]error)
- func (app *Application) Warn(title string, content string)
- type ConstantController
- type Context
- type Controller
- type ControllerAction
- type HttpController
- type MiddlewareInterface
- type ValidInterface
Constants ¶
const ( LogLevelTrace = camConstants.LevelTrace // log level: trace LogLevelDebug = camConstants.LevelDebug // log level: debug LogLevelInfo = camConstants.LevelInfo // log level: info LogLevelWarn = camConstants.LevelWarn // log level: warning LogLevelError = camConstants.LevelError // log level: error LogLevelFatal = camConstants.LevelFatal // log level: fatal LogLevelNone = camConstants.LevelNone // none LogLevelSuggest = camConstants.LevelSuggest // suggest this level to write file LogLevelAll = camConstants.LevelAll // all )
Log
const ( ValidModeInterface = camConstants.ModeInterface // Interface mode ValidModeTag = camConstants.ModeTag // Tag mode ValidModeBot = camConstants.ModeBoth // Interface and Tag mode )
Validation
Variables ¶
var App camBase.ApplicationInterface
var Rule = camValidation.Rule
#################### [START] instance export ####################
Functions ¶
func AddComponent ¶ added in v0.4.0
func AddComponent(name string, conf camBase.ComponentConfigInterface)
must run before cam.RunDefault
func NewCacheConfig ¶ added in v0.3.0
func NewCacheConfig() *camCache.CacheComponentConfig
new cache config
func NewConsoleConfig ¶
func NewConsoleConfig() *camConsole.ConsoleComponentConfig
new ConsoleComponent config
func NewDatabaseConfig ¶
func NewDatabaseConfig(driverName string, host string, port string, name string, username string, password string) *camDatabase.DatabaseComponentConfig
new DatabaseComponent config
func NewHttpConfig ¶ added in v0.3.0
func NewHttpConfig(port uint16) *camHttp.HttpComponentConfig
new ConsoleComponent config
func NewMailConfig ¶ added in v0.3.0
func NewMailConfig(email string, password string, host string) *camMail.MailComponentConfig
func NewRecover ¶ added in v0.3.0
func NewRecover(message string) *camStructs.Recover
func NewRule ¶ added in v0.4.0
func NewRule(fields []string, handlers ...camBase.ValidHandler) *camStructs.Rule
new rule
func NewSocketConfig ¶ added in v0.4.0
func NewSocketConfig(port uint16) *camSocket.SocketComponentConfig
new SocketComponentConfig
func NewTemplateCommand ¶ added in v0.3.0
func NewValidationConfig ¶ added in v0.4.0
func NewValidationConfig() *camValidation.ValidationComponentConfig
new ValidationComponentConfig
func NewWebsocketConfig ¶ added in v0.3.0
func NewWebsocketConfig(port uint16) *camWebsocket.WebsocketComponentConfig
new WebsocketComponent config
func RegisterController ¶ added in v0.4.0
func RegisterController(ctrl camBase.ControllerInterface)
must run before cam.RunDefault register controller
Types ¶
type Application ¶ added in v0.3.0
type Application struct { camBase.ApplicationInterface // contains filtered or unexported fields }
framework Application global instance struct define
func (*Application) AddComponentAfterRun ¶ added in v0.4.0
func (app *Application) AddComponentAfterRun(name string, conf camBase.ComponentConfigInterface) camBase.ComponentInterface
add component after app ran
func (*Application) AddConfig ¶ added in v0.3.0
func (app *Application) AddConfig(configI camBase.AppConfigInterface)
Add config. Must be called before calling cam.App.Run (). Merge as much as possible, otherwise overwrite.
config: new config
func (*Application) AddMigration ¶ added in v0.3.0
func (app *Application) AddMigration(m camBase.MigrationInterface)
add migration struct
func (*Application) Debug ¶ added in v0.3.0
func (app *Application) Debug(title string, content string)
log debug
func (*Application) Error ¶ added in v0.3.0
func (app *Application) Error(title string, content string)
log error
func (*Application) Fatal ¶ added in v0.3.0
func (app *Application) Fatal(title string, content string)
log fatal
func (*Application) GetCache ¶ added in v0.3.0
func (app *Application) GetCache() camBase.CacheComponentInterface
get cache component
func (*Application) GetComponent ¶ added in v0.3.0
func (app *Application) GetComponent(v camBase.ComponentInterface) camBase.ComponentInterface
Overwrite: Try to get instance using struct type
func (*Application) GetComponentByName ¶ added in v0.3.0
func (app *Application) GetComponentByName(name string) camBase.ComponentInterface
Overwrite: Try to get component instance by name. The name is define in config
func (*Application) GetDB ¶ added in v0.3.0
func (app *Application) GetDB() camBase.DatabaseComponentInterface
get default db component
func (*Application) GetEvn ¶ added in v0.3.0
func (app *Application) GetEvn(key string) string
get one .evn file values
func (*Application) GetMail ¶ added in v0.3.0
func (app *Application) GetMail() camBase.MailComponentInterface
get mail component
func (*Application) GetMigrateDict ¶ added in v0.3.0
func (app *Application) GetMigrateDict() map[string]camBase.MigrationInterface
func (*Application) GetParam ¶ added in v0.3.0
func (app *Application) GetParam(key string) interface{}
get value form app.config.Params.
func (*Application) Info ¶ added in v0.3.0
func (app *Application) Info(title string, content string)
log info
func (*Application) Trace ¶ added in v0.3.0
func (app *Application) Trace(title string, content string)
log trace
func (*Application) Valid ¶ added in v0.4.0
func (app *Application) Valid(v interface{}) (firstErr error, errDict map[string][]error)
valid struct
func (*Application) Warn ¶ added in v0.3.0
func (app *Application) Warn(title string, content string)
log warning
type ConstantController ¶ added in v0.3.0
type ConstantController struct {
camConsole.ConsoleController
}
type Context ¶ added in v0.3.0
type Context struct {
camContext.Context
}
type Controller ¶ added in v0.3.0
type Controller struct {
camRouter.Controller
}
type ControllerAction ¶ added in v0.3.0
type ControllerAction struct {
camRouter.ControllerAction
}
type HttpController ¶ added in v0.3.0
type HttpController struct {
camHttp.HttpController
}
type MiddlewareInterface ¶ added in v0.4.1
type MiddlewareInterface interface { camBase.MiddlewareInterface }
type ValidInterface ¶ added in v0.4.0
type ValidInterface interface { camBase.ValidInterface }
Directories
¶
Path | Synopsis |
---|---|
base
|
|
camMail
From: https://github.com/jordan-wright/email Datetime: 2020-03-09 17:28:00 From: https://github.com/jordan-wright/email Datetime: 2020-03-09 17:28:00
|
From: https://github.com/jordan-wright/email Datetime: 2020-03-09 17:28:00 From: https://github.com/jordan-wright/email Datetime: 2020-03-09 17:28:00 |