增加指定表model生成功能
This commit is contained in:
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"github.com/xxjwxc/public/mylog"
|
||||
|
||||
@@ -67,6 +68,9 @@ func init() {
|
||||
rootCmd.Flags().Int("port", 3306, "端口号")
|
||||
|
||||
rootCmd.Flags().StringP("table_prefix", "t", "", "表前缀")
|
||||
//增加表名称
|
||||
rootCmd.Flags().StringP("table_names", "b", "", "表名称")
|
||||
|
||||
}
|
||||
|
||||
// initConfig reads in config file and ENV variables if set.
|
||||
@@ -117,4 +121,13 @@ func MergeMysqlDbInfo() {
|
||||
tablePrefix := config.GetTablePrefix()
|
||||
mycobra.IfReplace(rootCmd, "table_prefix", &tablePrefix) // 如果设置了,更新
|
||||
config.SetTablePrefix(tablePrefix)
|
||||
|
||||
//更新tableNames
|
||||
tableNames := config.GetTableNames()
|
||||
if tableNames != "" {
|
||||
tableNames = strings.Replace(tableNames, "'", "", -1)
|
||||
}
|
||||
mycobra.IfReplace(rootCmd, "table_names", &tableNames) // 如果设置了,更新
|
||||
config.SetTableNames(tableNames)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user