Perfect annotation and remove redundant information output.

完善注释,去除多余的信息输出
This commit is contained in:
yanjiangtao
2021-03-30 20:23:40 +08:00
parent d6f49c5cce
commit d000eebda5
6 changed files with 11 additions and 9 deletions

View File

@@ -68,7 +68,7 @@ func init() {
rootCmd.Flags().Int("port", 3306, "端口号")
rootCmd.Flags().StringP("table_prefix", "t", "", "表前缀")
//增加表名称
//add table name. 增加表名称
rootCmd.Flags().StringP("table_names", "b", "", "表名称")
}
@@ -122,7 +122,7 @@ func MergeMysqlDbInfo() {
mycobra.IfReplace(rootCmd, "table_prefix", &tablePrefix) // 如果设置了,更新
config.SetTablePrefix(tablePrefix)
//更新tableNames
//update tableNames. 更新tableNames
tableNames := config.GetTableNames()
if tableNames != "" {
tableNames = strings.Replace(tableNames, "'", "", -1)

View File

@@ -257,7 +257,7 @@ func GetWebTagType() int {
return _map.WebTagType
}
//获取设置的表名
//GetTableNames get format tableNames by config. 获取格式化后设置的表名
func GetTableNames() string {
var sb strings.Builder
if _map.TableNames != "" {
@@ -284,12 +284,12 @@ func GetTableNames() string {
return sb.String()
}
//获取设置的表名
//GetOriginTableNames get origin tableNames. 获取原始的设置的表名
func GetOriginTableNames() string {
return _map.TableNames
}
//设置生成的表名
//SetTableNames set tableNames. 设置生成的表名
func SetTableNames(tableNames string) {
_map.TableNames = tableNames
}

View File

@@ -5,5 +5,5 @@ type IModel interface {
GenModel() DBInfo
GetDbName() string
GetPkgName() string // Getting package names through config outdir configuration.通过config outdir 配置获取包名
GetTableNames() string //获取设置表名
GetTableNames() string // Getting tableNames by config. 获取设置表名
}

View File

@@ -40,7 +40,7 @@ func (m *mysqlModel) GetTableNames() string {
return config.GetTableNames()
}
// GetTableNames get table name.获取原始指定的表名
// GetOriginTableNames get table name.获取原始指定的表名
func (m *mysqlModel) GetOriginTableNames() string {
return config.GetOriginTableNames()
}
@@ -84,7 +84,6 @@ func (m *mysqlModel) getPackageInfo(orm *mysqldb.MySqlDB, info *model.DBInfo) {
// }
// tabls = newTabls
// }
fmt.Println(tabls)
for tabName, notes := range tabls {
var tab model.TabInfo
tab.Name = tabName
@@ -111,7 +110,6 @@ func (m *mysqlModel) getPackageInfo(orm *mysqldb.MySqlDB, info *model.DBInfo) {
info.TabList = append(info.TabList, tab)
}
fmt.Println(info.TabList)
// sort tables
sort.Slice(info.TabList, func(i, j int) bool {
return info.TabList[i].Name < info.TabList[j].Name