support foreign key.添加 外键支持

This commit is contained in:
谢小军
2019-10-27 21:47:10 +08:00
parent d1d1fcb918
commit 56957a92cf
18 changed files with 616 additions and 153 deletions

View File

@@ -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)
}
}