delete SingularTable
删除单表配置模式
This commit is contained in:
@@ -41,7 +41,6 @@ out_dir : "./model" # out dir
|
|||||||
url_tag : json # web url tag(json,db(https://github.com/google/go-querystring))
|
url_tag : json # web url tag(json,db(https://github.com/google/go-querystring))
|
||||||
language : # language(English,中 文)
|
language : # language(English,中 文)
|
||||||
db_tag : gorm # DB tag(gorm,db)
|
db_tag : gorm # DB tag(gorm,db)
|
||||||
singular_table : true # Table name plural (big Camel-Case):gorm.SingularTable
|
|
||||||
simple : false #simple output
|
simple : false #simple output
|
||||||
is_out_sql : false # Whether to output sql
|
is_out_sql : false # Whether to output sql
|
||||||
is_out_func : true # Whether to output function
|
is_out_func : true # Whether to output function
|
||||||
@@ -97,7 +96,6 @@ Flags:
|
|||||||
## 4. Support for gorm attributes
|
## 4. Support for gorm attributes
|
||||||
|
|
||||||
- Database tables, column field annotation support
|
- Database tables, column field annotation support
|
||||||
- singular_table, Table name plural (big Camel-Case)
|
|
||||||
- json tag json tag output
|
- json tag json tag output
|
||||||
- gorm.Model [Support export gorm.model>>>](doc/export.md)
|
- gorm.Model [Support export gorm.model>>>](doc/export.md)
|
||||||
- PRIMARY_KEY Specifies column as primary key
|
- PRIMARY_KEY Specifies column as primary key
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ out_dir: ./model # 输出目录
|
|||||||
url_tag: json # web url tag(json,db(https://github.com/google/go-querystring))
|
url_tag: json # web url tag(json,db(https://github.com/google/go-querystring))
|
||||||
language: 中 文 # 语言(English,中 文)
|
language: 中 文 # 语言(English,中 文)
|
||||||
db_tag: gorm # 数据库标签(gorm,db)
|
db_tag: gorm # 数据库标签(gorm,db)
|
||||||
singular_table: true # 单表模式:true:禁用表名复数,false:采用表明复数 参考:gorm.SingularTable
|
|
||||||
simple: false # 简单输出(默认gorm标签不输出)
|
simple: false # 简单输出(默认gorm标签不输出)
|
||||||
is_out_sql: false # 是否输出 sql 原信息
|
is_out_sql: false # 是否输出 sql 原信息
|
||||||
is_out_func: true # 是否输出 快捷函数
|
is_out_func: true # 是否输出 快捷函数
|
||||||
@@ -105,7 +104,6 @@ Flags:
|
|||||||
## 4. 支持gorm 相关属性
|
## 4. 支持gorm 相关属性
|
||||||
|
|
||||||
- 数据库表,列字段注释支持
|
- 数据库表,列字段注释支持
|
||||||
- singular_table 表名复数(大驼峰)
|
|
||||||
- json tag json标签输出
|
- json tag json标签输出
|
||||||
- gorm.Model 基本模型 [支持gorm.Model模式导出>>>](https://github.com/xxjwxc/gormt/tree/master/doc/export_cn.md)
|
- gorm.Model 基本模型 [支持gorm.Model模式导出>>>](https://github.com/xxjwxc/gormt/tree/master/doc/export_cn.md)
|
||||||
- PRIMARY_KEY 将列指定为主键
|
- PRIMARY_KEY 将列指定为主键
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ out_dir : ./model # 输出目录
|
|||||||
url_tag : json # web url tag(json,db(https://github.com/google/go-querystring))
|
url_tag : json # web url tag(json,db(https://github.com/google/go-querystring))
|
||||||
language : # 语言(English,中 文)
|
language : # 语言(English,中 文)
|
||||||
db_tag : gorm # 数据库标签(gorm,db)
|
db_tag : gorm # 数据库标签(gorm,db)
|
||||||
singular_table : true # 单表模式:true:禁用表名复数,false:采用表名复数 参考:gorm.SingularTable
|
|
||||||
simple : false # 简单输出(默认gorm标签不输出)
|
simple : false # 简单输出(默认gorm标签不输出)
|
||||||
is_out_sql : false # 是否输出 sql 原信息
|
is_out_sql : false # 是否输出 sql 原信息
|
||||||
is_out_func : true # 是否输出 快捷函数
|
is_out_func : true # 是否输出 快捷函数
|
||||||
|
|||||||
@@ -100,13 +100,9 @@ func MergeMysqlDbInfo() {
|
|||||||
mycobra.IfReplace(rootCmd, "outdir", &dir) // 如果设置了,更新
|
mycobra.IfReplace(rootCmd, "outdir", &dir) // 如果设置了,更新
|
||||||
config.SetOutDir(dir)
|
config.SetOutDir(dir)
|
||||||
|
|
||||||
st := config.GetSingularTable()
|
|
||||||
mycobra.IfReplace(rootCmd, "singular", &st) // 如果设置了,更新
|
|
||||||
config.SetSingularTable(st)
|
|
||||||
|
|
||||||
fk := config.GetIsForeignKey()
|
fk := config.GetIsForeignKey()
|
||||||
mycobra.IfReplace(rootCmd, "foreign", &fk) // 如果设置了,更新
|
mycobra.IfReplace(rootCmd, "foreign", &fk) // 如果设置了,更新
|
||||||
config.SetForeignKey(st)
|
config.SetForeignKey(fk)
|
||||||
|
|
||||||
funcKey := config.GetIsOutFunc()
|
funcKey := config.GetIsOutFunc()
|
||||||
mycobra.IfReplace(rootCmd, "fun", &funcKey) // 如果设置了,更新
|
mycobra.IfReplace(rootCmd, "fun", &funcKey) // 如果设置了,更新
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ type Config struct {
|
|||||||
Simple bool `yaml:"simple"`
|
Simple bool `yaml:"simple"`
|
||||||
IsWEBTag bool `yaml:"is_web_tag"`
|
IsWEBTag bool `yaml:"is_web_tag"`
|
||||||
IsWebTagPkHidden bool `yaml:"is_web_tag_pk_hidden"` // web标记是否隐藏主键
|
IsWebTagPkHidden bool `yaml:"is_web_tag_pk_hidden"` // web标记是否隐藏主键
|
||||||
SingularTable bool `yaml:"singular_table"`
|
|
||||||
IsForeignKey bool `yaml:"is_foreign_key"`
|
IsForeignKey bool `yaml:"is_foreign_key"`
|
||||||
IsOutSQL bool `yaml:"is_out_sql"`
|
IsOutSQL bool `yaml:"is_out_sql"`
|
||||||
IsOutFunc bool `yaml:"is_out_func"`
|
IsOutFunc bool `yaml:"is_out_func"`
|
||||||
@@ -71,15 +70,15 @@ func GetOutDir() string {
|
|||||||
return _map.OutDir
|
return _map.OutDir
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSingularTable Set Disabled Table Name Plurals.设置禁用表名复数
|
// // SetSingularTable Set Disabled Table Name Plurals.设置禁用表名复数
|
||||||
func SetSingularTable(b bool) {
|
// func SetSingularTable(b bool) {
|
||||||
_map.SingularTable = b
|
// _map.SingularTable = b
|
||||||
}
|
// }
|
||||||
|
|
||||||
// GetSingularTable Get Disabled Table Name Plurals.获取禁用表名复数
|
// // GetSingularTable Get Disabled Table Name Plurals.获取禁用表名复数
|
||||||
func GetSingularTable() bool {
|
// func GetSingularTable() bool {
|
||||||
return _map.SingularTable
|
// return _map.SingularTable
|
||||||
}
|
// }
|
||||||
|
|
||||||
// GetSimple simple output.简单输出
|
// GetSimple simple output.简单输出
|
||||||
func GetSimple() bool {
|
func GetSimple() bool {
|
||||||
|
|||||||
@@ -31,17 +31,17 @@ var _map = Config{
|
|||||||
Password: "root",
|
Password: "root",
|
||||||
Database: "test",
|
Database: "test",
|
||||||
},
|
},
|
||||||
OutDir: "./model",
|
OutDir: "./model",
|
||||||
URLTag: "json",
|
URLTag: "json",
|
||||||
Language: "中 文",
|
Language: "中 文",
|
||||||
DbTag: "gorm",
|
DbTag: "gorm",
|
||||||
Simple: false,
|
Simple: false,
|
||||||
IsWEBTag: false,
|
IsWEBTag: false,
|
||||||
SingularTable: true,
|
// SingularTable: true,
|
||||||
IsForeignKey: true,
|
IsForeignKey: true,
|
||||||
IsOutSQL: false,
|
IsOutSQL: false,
|
||||||
IsOutFunc: true,
|
IsOutFunc: true,
|
||||||
IsGUI: false,
|
IsGUI: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
var configPath string
|
var configPath string
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ service_displayname : #服务显示名
|
|||||||
sercice_desc : #服务描述
|
sercice_desc : #服务描述
|
||||||
is_dev : false # 是否开发者模式
|
is_dev : false # 是否开发者模式
|
||||||
out_dir : ./db # 输出目录
|
out_dir : ./db # 输出目录
|
||||||
singular_table : true # 单表模式:true:禁用表名复数,false:采用表明复数 参考:gorm.SingularTable
|
|
||||||
simple : true #简单输出
|
simple : true #简单输出
|
||||||
isJsonTag : true #是否打json标记
|
isJsonTag : true #是否打json标记
|
||||||
mysql_info:
|
mysql_info:
|
||||||
|
|||||||
@@ -221,8 +221,6 @@ func enterSet(g *gocui.Gui, v *gocui.View) error {
|
|||||||
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetIsDev())))
|
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetIsDev())))
|
||||||
form.AddSelect("is_simple", SLocalize("is_simple"), formPart[0], formPart[2]).
|
form.AddSelect("is_simple", SLocalize("is_simple"), formPart[0], formPart[2]).
|
||||||
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetSimple())))
|
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetSimple())))
|
||||||
form.AddSelect("is_singular", SLocalize("is_singular"), formPart[0], formPart[2]).
|
|
||||||
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetSingularTable())))
|
|
||||||
form.AddSelect("is_out_sql", SLocalize("is_out_sql"), formPart[0], formPart[2]).
|
form.AddSelect("is_out_sql", SLocalize("is_out_sql"), formPart[0], formPart[2]).
|
||||||
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetIsOutSQL())))
|
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetIsOutSQL())))
|
||||||
form.AddSelect("is_out_func", SLocalize("is_out_func"), formPart[0], formPart[2]).
|
form.AddSelect("is_out_func", SLocalize("is_out_func"), formPart[0], formPart[2]).
|
||||||
@@ -294,7 +292,6 @@ func buttonSave(g *gocui.Gui, v *gocui.View) error {
|
|||||||
|
|
||||||
config.SetIsDev(getBool(mp["is_dev"]))
|
config.SetIsDev(getBool(mp["is_dev"]))
|
||||||
config.SetSimple(getBool(mp["is_simple"]))
|
config.SetSimple(getBool(mp["is_simple"]))
|
||||||
config.SetSingularTable(getBool(mp["is_singular"]))
|
|
||||||
config.SetIsOutSQL(getBool(mp["is_out_sql"]))
|
config.SetIsOutSQL(getBool(mp["is_out_sql"]))
|
||||||
config.SetIsOutFunc(getBool(mp["is_out_func"]))
|
config.SetIsOutFunc(getBool(mp["is_out_func"]))
|
||||||
config.SetForeignKey(getBool(mp["is_foreign_key"]))
|
config.SetForeignKey(getBool(mp["is_foreign_key"]))
|
||||||
|
|||||||
@@ -74,9 +74,6 @@ func addChinese() error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "is_dev",
|
ID: "is_dev",
|
||||||
Other: " 开 发 模 式:",
|
Other: " 开 发 模 式:",
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "is_singular",
|
|
||||||
Other: " 单 表 模 式 :",
|
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "is_simple",
|
ID: "is_simple",
|
||||||
Other: " 简 单 输 出 :",
|
Other: " 简 单 输 出 :",
|
||||||
@@ -174,9 +171,6 @@ func addEnglish() error {
|
|||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "is_simple",
|
ID: "is_simple",
|
||||||
Other: "is simple :",
|
Other: "is simple :",
|
||||||
}, &i18n.Message{
|
|
||||||
ID: "is_singular",
|
|
||||||
Other: "is singular :",
|
|
||||||
}, &i18n.Message{
|
}, &i18n.Message{
|
||||||
ID: "is_out_sql",
|
ID: "is_out_sql",
|
||||||
Other: "is out sql :",
|
Other: "is out sql :",
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ import (
|
|||||||
|
|
||||||
// getCamelName Big Hump or Capital Letter.大驼峰或者首字母大写
|
// getCamelName Big Hump or Capital Letter.大驼峰或者首字母大写
|
||||||
func getCamelName(name string) string {
|
func getCamelName(name string) string {
|
||||||
if !config.GetSingularTable() { // If the table name plural is globally disabled.如果全局禁用表名复数
|
// if !config.GetSingularTable() { // If the table name plural is globally disabled.如果全局禁用表名复数
|
||||||
return mybigcamel.Marshal(strings.TrimSuffix(name, "s"))
|
// return mybigcamel.Marshal(strings.TrimSuffix(name, "s"))
|
||||||
}
|
// }
|
||||||
|
|
||||||
return mybigcamel.Marshal(name)
|
return mybigcamel.Marshal(name)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ CREATE TABLE `user_account_tbl` (
|
|||||||
|
|
||||||
### Mult complex export without foreign key
|
### Mult complex export without foreign key
|
||||||
|
|
||||||
- param:singular_table = false simple = false is_foreign_key = false
|
- param: simple = false is_foreign_key = false
|
||||||
|
|
||||||
###### --->export result
|
###### --->export result
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
### Simple-export-with-JSON
|
### Simple-export-with-JSON
|
||||||
|
|
||||||
- param:singular_table = false simple = true is_web_tag = true is_foreign_key = false
|
- param: simple = true is_web_tag = true is_foreign_key = false
|
||||||
|
|
||||||
###### --->export result
|
###### --->export result
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
### Simple export without JSON
|
### Simple export without JSON
|
||||||
|
|
||||||
- param:singular_table = false simple = true is_web_tag = false is_foreign_key = false
|
- param: simple = true is_web_tag = false is_foreign_key = false
|
||||||
|
|
||||||
###### --->export result
|
###### --->export result
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
### Simple with foreign key mode export
|
### Simple with foreign key mode export
|
||||||
|
|
||||||
- param:singular_table = false simple = true is_web_tag = false is_foreign_key = true
|
- param: simple = true is_web_tag = false is_foreign_key = true
|
||||||
|
|
||||||
###### --->export result
|
###### --->export result
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ CREATE TABLE `user_info_tbl` (
|
|||||||
|
|
||||||
### Support export gorm.model
|
### Support export gorm.model
|
||||||
|
|
||||||
- param:singular_table = false simple = true is_web_tag = false
|
- param: simple = true is_web_tag = false
|
||||||
|
|
||||||
###### --->export result
|
###### --->export result
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ CREATE TABLE `user_account_tbl` (
|
|||||||
|
|
||||||
### 复杂不带外键导出
|
### 复杂不带外键导出
|
||||||
|
|
||||||
- 参数:singular_table = false simple = false is_foreign_key = false
|
- 参数: simple = false is_foreign_key = false
|
||||||
|
|
||||||
###### --->导出结果
|
###### --->导出结果
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
### 简单带json导出
|
### 简单带json导出
|
||||||
|
|
||||||
- 参数:singular_table = false simple = true is_web_tag = true is_foreign_key = false
|
- 参数: simple = true is_web_tag = true is_foreign_key = false
|
||||||
|
|
||||||
###### --->导出结果
|
###### --->导出结果
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
### 简单不带json导出
|
### 简单不带json导出
|
||||||
|
|
||||||
- 参数:singular_table = false simple = true is_web_tag = false is_foreign_key = false
|
- 参数: simple = true is_web_tag = false is_foreign_key = false
|
||||||
|
|
||||||
###### --->导出结果
|
###### --->导出结果
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
### 简单带外键模式导出
|
### 简单带外键模式导出
|
||||||
|
|
||||||
- 参数:singular_table = false simple = true is_web_tag = false is_foreign_key = true
|
- 参数: simple = true is_web_tag = false is_foreign_key = true
|
||||||
|
|
||||||
###### --->导出结果
|
###### --->导出结果
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ CREATE TABLE `user_info_tbl` (
|
|||||||
|
|
||||||
### 支持gorm.Model模式导出
|
### 支持gorm.Model模式导出
|
||||||
|
|
||||||
- 参数:singular_table = false simple = true is_web_tag = false
|
- 参数: simple = true is_web_tag = false
|
||||||
|
|
||||||
###### --->导出结果
|
###### --->导出结果
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user