Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cli.Command{
Name: "migrate",
Usage: "根据数据库表生成模板代码,模板可以自定义",
Flags: flags,
Action: action,
}
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DS *DS `yaml:"ds"`
Target *ReverseTarget `yaml:"target"`
}
Config config file
type Custom ¶
type Custom struct {
OutDir string `yaml:"out-dir"` // 必须,生成文件路径
TemplateDir string `yaml:"template-dir"` // 可选,模板路径
TagName string `yaml:"tag-name"` // 可选,生成 model 的 tag,默认 json
UseAdmin bool `yaml:"use-admin"` // 可选,是否生成管理后台接口和页面,对所有表生效
Gomod string `yaml:"gomod"` // 必须,项目 go mod module 配置
Var Var `yaml:"exy"` // 自定义变量,对所有表生效
}
type ReverseTarget ¶
type ReverseTarget struct {
Custom *Custom `yaml:"custom"` // 自定义参数
Tables map[string]TableConfig `yaml:"tables"` // 生成的数据库表名和对应的自定义变量
}
type Table ¶
type Table struct {
Name string
StructName string
Columns []Column
PrimaryKey Column
AutoIncrement bool
Comment string
StoreEngine string
GoImports []string
}
Table represents a database table
type TableConfig ¶
Click to show internal directories.
Click to hide internal directories.