Perfect annotation and remove redundant information output.
完善注释,去除多余的信息输出
This commit is contained in:
@@ -51,6 +51,7 @@ is_null_to_point : false # database is 'DEFAULT NULL' then set element type as p
|
|||||||
is_web_tag: false
|
is_web_tag: false
|
||||||
is_web_tag_pk_hidden: false
|
is_web_tag_pk_hidden: false
|
||||||
table_prefix: "" #table prefix
|
table_prefix: "" #table prefix
|
||||||
|
table_names: "" # Specified table generation, multiple tables with , separated
|
||||||
db_info :
|
db_info :
|
||||||
host : "127.0.0.1"
|
host : "127.0.0.1"
|
||||||
port : 3306
|
port : 3306
|
||||||
@@ -88,6 +89,7 @@ Flags:
|
|||||||
-p, --password string 密码.
|
-p, --password string 密码.
|
||||||
--port int 端口号 (default 3306)
|
--port int 端口号 (default 3306)
|
||||||
-s, --singular 是否禁用表名复数
|
-s, --singular 是否禁用表名复数
|
||||||
|
-b, --table_names string 表名称
|
||||||
-l, --url string url标签(json,url)
|
-l, --url string url标签(json,url)
|
||||||
-u, --user string 用户名.
|
-u, --user string 用户名.
|
||||||
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ is_null_to_point: false # 数据库默认 'DEFAULT NULL' 时设置结构为指
|
|||||||
is_web_tag: false
|
is_web_tag: false
|
||||||
is_web_tag_pk_hidden: false
|
is_web_tag_pk_hidden: false
|
||||||
table_prefix: "" #表前缀
|
table_prefix: "" #表前缀
|
||||||
|
table_names: "" #指定表生成,多个表用,隔开
|
||||||
db_info:
|
db_info:
|
||||||
host : 127.0.0.1
|
host : 127.0.0.1
|
||||||
port : 3306
|
port : 3306
|
||||||
@@ -101,6 +102,7 @@ Flags:
|
|||||||
-p, --password string 密码.
|
-p, --password string 密码.
|
||||||
--port int 端口号 (default 3306)
|
--port int 端口号 (default 3306)
|
||||||
-s, --singular 是否禁用表名复数
|
-s, --singular 是否禁用表名复数
|
||||||
|
-b, --table_names string 表名称
|
||||||
-l, --url string url标签(json,url)
|
-l, --url string url标签(json,url)
|
||||||
-u, --user string 用户名.
|
-u, --user string 用户名.
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func init() {
|
|||||||
rootCmd.Flags().Int("port", 3306, "端口号")
|
rootCmd.Flags().Int("port", 3306, "端口号")
|
||||||
|
|
||||||
rootCmd.Flags().StringP("table_prefix", "t", "", "表前缀")
|
rootCmd.Flags().StringP("table_prefix", "t", "", "表前缀")
|
||||||
//增加表名称
|
//add table name. 增加表名称
|
||||||
rootCmd.Flags().StringP("table_names", "b", "", "表名称")
|
rootCmd.Flags().StringP("table_names", "b", "", "表名称")
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ func MergeMysqlDbInfo() {
|
|||||||
mycobra.IfReplace(rootCmd, "table_prefix", &tablePrefix) // 如果设置了,更新
|
mycobra.IfReplace(rootCmd, "table_prefix", &tablePrefix) // 如果设置了,更新
|
||||||
config.SetTablePrefix(tablePrefix)
|
config.SetTablePrefix(tablePrefix)
|
||||||
|
|
||||||
//更新tableNames
|
//update tableNames. 更新tableNames
|
||||||
tableNames := config.GetTableNames()
|
tableNames := config.GetTableNames()
|
||||||
if tableNames != "" {
|
if tableNames != "" {
|
||||||
tableNames = strings.Replace(tableNames, "'", "", -1)
|
tableNames = strings.Replace(tableNames, "'", "", -1)
|
||||||
|
|||||||
@@ -257,7 +257,7 @@ func GetWebTagType() int {
|
|||||||
return _map.WebTagType
|
return _map.WebTagType
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取设置的表名
|
//GetTableNames get format tableNames by config. 获取格式化后设置的表名
|
||||||
func GetTableNames() string {
|
func GetTableNames() string {
|
||||||
var sb strings.Builder
|
var sb strings.Builder
|
||||||
if _map.TableNames != "" {
|
if _map.TableNames != "" {
|
||||||
@@ -284,12 +284,12 @@ func GetTableNames() string {
|
|||||||
return sb.String()
|
return sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取设置的表名
|
//GetOriginTableNames get origin tableNames. 获取原始的设置的表名
|
||||||
func GetOriginTableNames() string {
|
func GetOriginTableNames() string {
|
||||||
return _map.TableNames
|
return _map.TableNames
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置生成的表名
|
//SetTableNames set tableNames. 设置生成的表名
|
||||||
func SetTableNames(tableNames string) {
|
func SetTableNames(tableNames string) {
|
||||||
_map.TableNames = tableNames
|
_map.TableNames = tableNames
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,5 @@ type IModel interface {
|
|||||||
GenModel() DBInfo
|
GenModel() DBInfo
|
||||||
GetDbName() string
|
GetDbName() string
|
||||||
GetPkgName() string // Getting package names through config outdir configuration.通过config outdir 配置获取包名
|
GetPkgName() string // Getting package names through config outdir configuration.通过config outdir 配置获取包名
|
||||||
GetTableNames() string //获取设置表名
|
GetTableNames() string // Getting tableNames by config. 获取设置的表名
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func (m *mysqlModel) GetTableNames() string {
|
|||||||
return config.GetTableNames()
|
return config.GetTableNames()
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTableNames get table name.获取原始指定的表名
|
// GetOriginTableNames get table name.获取原始指定的表名
|
||||||
func (m *mysqlModel) GetOriginTableNames() string {
|
func (m *mysqlModel) GetOriginTableNames() string {
|
||||||
return config.GetOriginTableNames()
|
return config.GetOriginTableNames()
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,6 @@ func (m *mysqlModel) getPackageInfo(orm *mysqldb.MySqlDB, info *model.DBInfo) {
|
|||||||
// }
|
// }
|
||||||
// tabls = newTabls
|
// tabls = newTabls
|
||||||
// }
|
// }
|
||||||
fmt.Println(tabls)
|
|
||||||
for tabName, notes := range tabls {
|
for tabName, notes := range tabls {
|
||||||
var tab model.TabInfo
|
var tab model.TabInfo
|
||||||
tab.Name = tabName
|
tab.Name = tabName
|
||||||
@@ -111,7 +110,6 @@ func (m *mysqlModel) getPackageInfo(orm *mysqldb.MySqlDB, info *model.DBInfo) {
|
|||||||
|
|
||||||
info.TabList = append(info.TabList, tab)
|
info.TabList = append(info.TabList, tab)
|
||||||
}
|
}
|
||||||
fmt.Println(info.TabList)
|
|
||||||
// sort tables
|
// sort tables
|
||||||
sort.Slice(info.TabList, func(i, j int) bool {
|
sort.Slice(info.TabList, func(i, j int) bool {
|
||||||
return info.TabList[i].Name < info.TabList[j].Name
|
return info.TabList[i].Name < info.TabList[j].Name
|
||||||
|
|||||||
Reference in New Issue
Block a user