Documentation ¶
Index ¶
- type BaseMigration
- type ConsoleComponent
- func (comp *ConsoleComponent) GetMigrateUpVersionList() []string
- func (comp *ConsoleComponent) Init(configI camBase.ComponentConfigInterface)
- func (comp *ConsoleComponent) MigrateDown()
- func (comp *ConsoleComponent) MigrateLastVersion() string
- func (comp *ConsoleComponent) MigrateUp()
- func (comp *ConsoleComponent) RunAction()
- type ConsoleComponentConfig
- type ConsoleController
- type MigrateController
- type Migration
- type MigrationTpl
- type XormController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseMigration ¶
type BaseMigration struct { camBase.MigrationInterface // contains filtered or unexported fields }
base migration struct
type ConsoleComponent ¶
type ConsoleComponent struct { component.Component camPluginRouter.RouterPlugin // contains filtered or unexported fields }
command component
func (*ConsoleComponent) GetMigrateUpVersionList ¶
func (comp *ConsoleComponent) GetMigrateUpVersionList() []string
get migrate up version list.
func (*ConsoleComponent) Init ¶
func (comp *ConsoleComponent) Init(configI camBase.ComponentConfigInterface)
init
func (*ConsoleComponent) MigrateDown ¶
func (comp *ConsoleComponent) MigrateDown()
down last database version
func (*ConsoleComponent) MigrateLastVersion ¶
func (comp *ConsoleComponent) MigrateLastVersion() string
func (*ConsoleComponent) MigrateUp ¶
func (comp *ConsoleComponent) MigrateUp()
up all database version
func (*ConsoleComponent) RunAction ¶
func (comp *ConsoleComponent) RunAction()
run command Example:
# go build cam.go # ./cam controllerName/actionName param1 param2
type ConsoleComponentConfig ¶
type ConsoleComponentConfig struct { component.ComponentConfig camPluginRouter.RouterPluginConfig DatabaseDir string // DatabaseComponentConfig file storage path. Default is: /[path to run dir]/database XormTemplateDir string // xorm template path. }
console config
func NewConsoleComponentConfig ¶
func NewConsoleComponentConfig() *ConsoleComponentConfig
new console config
func (*ConsoleComponentConfig) SetDatabaseDir ¶
func (config *ConsoleComponentConfig) SetDatabaseDir(dir string) *ConsoleComponentConfig
set migration's file dir
func (*ConsoleComponentConfig) SetXormTemplateDir ¶
func (config *ConsoleComponentConfig) SetXormTemplateDir(dir string) *ConsoleComponentConfig
set xorm dir
type ConsoleController ¶
type ConsoleController struct {
camPluginRouter.Controller
}
func (*ConsoleController) GetArgv ¶
func (ctrl *ConsoleController) GetArgv(key int) string
get params key start is 0 example:
/path/to/main.exe console/run argv0 argv1 controller.GetArgv(0) => "argv0" controller.GetArgv(1) => "argv1" controller.GetArgv(2) => "" controller.GetArgv(-1) => ""
func (*ConsoleController) GetConsoleComponent ¶
func (ctrl *ConsoleController) GetConsoleComponent() *ConsoleComponent
get console component
type MigrateController ¶
type MigrateController struct {
ConsoleController
}
type MigrationTpl ¶
type MigrationTpl struct {
ClassName string
}
type XormController ¶
type XormController struct {
ConsoleController
}
xorm's console controller
func (*XormController) Generate ¶
func (ctrl *XormController) Generate()
Generate ORM classes automatically according to the database xorm reverse
usage: xorm reverse [-s] driverName datasourceName tmplPath [generatedPath] [tableFilterReg] according database's tables and columns to generate codes for Go, C++ and etc. -s Generated one go file for every table driverName Database driver name, now supported four: mysql mymysql sqlite3 postgres datasourceName Database connection uri, for detail infomation please visit driver's project page tmplPath Template dir for generated. the default templates dir has provide 1 template generatedPath This parameter is optional, if blank, the default value is model, then will generated all codes in model dir tableFilterReg Table name filter regexp
func (*XormController) InstallCmdXorm ¶
func (ctrl *XormController) InstallCmdXorm()
install github.com/go-xorm/cmd/xorm
Click to show internal directories.
Click to hide internal directories.