support foreign key.添加 外键支持
This commit is contained in:
@@ -17,6 +17,7 @@ import (
|
||||
var mysqlInfo config.MysqlDbInfo
|
||||
var outDir string
|
||||
var singularTable bool
|
||||
var foreignKey bool
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
Use: "main",
|
||||
@@ -56,6 +57,9 @@ func init() {
|
||||
rootCmd.PersistentFlags().BoolVarP(&singularTable, "singular", "s", false, "是否禁用表名复数")
|
||||
rootCmd.MarkFlagRequired("singular")
|
||||
|
||||
rootCmd.PersistentFlags().BoolVarP(&foreignKey, "foreign", "f", false, "是否导出外键关联")
|
||||
rootCmd.MarkFlagRequired("foreign")
|
||||
|
||||
rootCmd.Flags().IntVar(&mysqlInfo.Port, "port", 3306, "端口号")
|
||||
}
|
||||
|
||||
@@ -102,4 +106,8 @@ func MergeMysqlDbInfo() {
|
||||
if singularTable {
|
||||
config.SetSingularTable(singularTable)
|
||||
}
|
||||
|
||||
if foreignKey {
|
||||
config.SetForeignKey(foreignKey)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user