delete SingularTable
删除单表配置模式
This commit is contained in:
@@ -100,13 +100,9 @@ func MergeMysqlDbInfo() {
|
||||
mycobra.IfReplace(rootCmd, "outdir", &dir) // 如果设置了,更新
|
||||
config.SetOutDir(dir)
|
||||
|
||||
st := config.GetSingularTable()
|
||||
mycobra.IfReplace(rootCmd, "singular", &st) // 如果设置了,更新
|
||||
config.SetSingularTable(st)
|
||||
|
||||
fk := config.GetIsForeignKey()
|
||||
mycobra.IfReplace(rootCmd, "foreign", &fk) // 如果设置了,更新
|
||||
config.SetForeignKey(st)
|
||||
config.SetForeignKey(fk)
|
||||
|
||||
funcKey := config.GetIsOutFunc()
|
||||
mycobra.IfReplace(rootCmd, "fun", &funcKey) // 如果设置了,更新
|
||||
|
||||
@@ -17,7 +17,6 @@ type Config struct {
|
||||
Simple bool `yaml:"simple"`
|
||||
IsWEBTag bool `yaml:"is_web_tag"`
|
||||
IsWebTagPkHidden bool `yaml:"is_web_tag_pk_hidden"` // web标记是否隐藏主键
|
||||
SingularTable bool `yaml:"singular_table"`
|
||||
IsForeignKey bool `yaml:"is_foreign_key"`
|
||||
IsOutSQL bool `yaml:"is_out_sql"`
|
||||
IsOutFunc bool `yaml:"is_out_func"`
|
||||
@@ -71,15 +70,15 @@ func GetOutDir() string {
|
||||
return _map.OutDir
|
||||
}
|
||||
|
||||
// SetSingularTable Set Disabled Table Name Plurals.设置禁用表名复数
|
||||
func SetSingularTable(b bool) {
|
||||
_map.SingularTable = b
|
||||
}
|
||||
// // SetSingularTable Set Disabled Table Name Plurals.设置禁用表名复数
|
||||
// func SetSingularTable(b bool) {
|
||||
// _map.SingularTable = b
|
||||
// }
|
||||
|
||||
// GetSingularTable Get Disabled Table Name Plurals.获取禁用表名复数
|
||||
func GetSingularTable() bool {
|
||||
return _map.SingularTable
|
||||
}
|
||||
// // GetSingularTable Get Disabled Table Name Plurals.获取禁用表名复数
|
||||
// func GetSingularTable() bool {
|
||||
// return _map.SingularTable
|
||||
// }
|
||||
|
||||
// GetSimple simple output.简单输出
|
||||
func GetSimple() bool {
|
||||
|
||||
@@ -31,17 +31,17 @@ var _map = Config{
|
||||
Password: "root",
|
||||
Database: "test",
|
||||
},
|
||||
OutDir: "./model",
|
||||
URLTag: "json",
|
||||
Language: "中 文",
|
||||
DbTag: "gorm",
|
||||
Simple: false,
|
||||
IsWEBTag: false,
|
||||
SingularTable: true,
|
||||
IsForeignKey: true,
|
||||
IsOutSQL: false,
|
||||
IsOutFunc: true,
|
||||
IsGUI: false,
|
||||
OutDir: "./model",
|
||||
URLTag: "json",
|
||||
Language: "中 文",
|
||||
DbTag: "gorm",
|
||||
Simple: false,
|
||||
IsWEBTag: false,
|
||||
// SingularTable: true,
|
||||
IsForeignKey: true,
|
||||
IsOutSQL: false,
|
||||
IsOutFunc: true,
|
||||
IsGUI: false,
|
||||
}
|
||||
|
||||
var configPath string
|
||||
|
||||
@@ -13,7 +13,6 @@ service_displayname : #服务显示名
|
||||
sercice_desc : #服务描述
|
||||
is_dev : false # 是否开发者模式
|
||||
out_dir : ./db # 输出目录
|
||||
singular_table : true # 单表模式:true:禁用表名复数,false:采用表明复数 参考:gorm.SingularTable
|
||||
simple : true #简单输出
|
||||
isJsonTag : true #是否打json标记
|
||||
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())))
|
||||
form.AddSelect("is_simple", SLocalize("is_simple"), formPart[0], formPart[2]).
|
||||
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]).
|
||||
AddOptions(SLocalize("true"), SLocalize("false")).SetSelected(SLocalize(tools.AsString(config.GetIsOutSQL())))
|
||||
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.SetSimple(getBool(mp["is_simple"]))
|
||||
config.SetSingularTable(getBool(mp["is_singular"]))
|
||||
config.SetIsOutSQL(getBool(mp["is_out_sql"]))
|
||||
config.SetIsOutFunc(getBool(mp["is_out_func"]))
|
||||
config.SetForeignKey(getBool(mp["is_foreign_key"]))
|
||||
|
||||
@@ -74,9 +74,6 @@ func addChinese() error {
|
||||
}, &i18n.Message{
|
||||
ID: "is_dev",
|
||||
Other: " 开 发 模 式:",
|
||||
}, &i18n.Message{
|
||||
ID: "is_singular",
|
||||
Other: " 单 表 模 式 :",
|
||||
}, &i18n.Message{
|
||||
ID: "is_simple",
|
||||
Other: " 简 单 输 出 :",
|
||||
@@ -174,9 +171,6 @@ func addEnglish() error {
|
||||
}, &i18n.Message{
|
||||
ID: "is_simple",
|
||||
Other: "is simple :",
|
||||
}, &i18n.Message{
|
||||
ID: "is_singular",
|
||||
Other: "is singular :",
|
||||
}, &i18n.Message{
|
||||
ID: "is_out_sql",
|
||||
Other: "is out sql :",
|
||||
|
||||
@@ -16,9 +16,9 @@ import (
|
||||
|
||||
// getCamelName Big Hump or Capital Letter.大驼峰或者首字母大写
|
||||
func getCamelName(name string) string {
|
||||
if !config.GetSingularTable() { // If the table name plural is globally disabled.如果全局禁用表名复数
|
||||
return mybigcamel.Marshal(strings.TrimSuffix(name, "s"))
|
||||
}
|
||||
// if !config.GetSingularTable() { // If the table name plural is globally disabled.如果全局禁用表名复数
|
||||
// return mybigcamel.Marshal(strings.TrimSuffix(name, "s"))
|
||||
// }
|
||||
|
||||
return mybigcamel.Marshal(name)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user