fix db_tag
This commit is contained in:
@@ -16,7 +16,6 @@ type Config struct {
|
|||||||
Language string `yaml:"language"` // language
|
Language string `yaml:"language"` // language
|
||||||
DbTag string `yaml:"db_tag"` // 数据库标签(gormt,db)
|
DbTag string `yaml:"db_tag"` // 数据库标签(gormt,db)
|
||||||
Simple bool `yaml:"simple"`
|
Simple bool `yaml:"simple"`
|
||||||
IsDbTag bool `yaml:"is_db_tag"` // 是否输出 数据库标签
|
|
||||||
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标记是否隐藏主键
|
||||||
IsForeignKey bool `yaml:"is_foreign_key"`
|
IsForeignKey bool `yaml:"is_foreign_key"`
|
||||||
@@ -99,16 +98,6 @@ func SetSimple(b bool) {
|
|||||||
_map.Simple = b
|
_map.Simple = b
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIsDbTag is_db_tag
|
|
||||||
func GetIsDbTag() bool {
|
|
||||||
return _map.IsDbTag
|
|
||||||
}
|
|
||||||
|
|
||||||
// SetIsDbTag is_db_tag
|
|
||||||
func SetIsDbTag(b bool) {
|
|
||||||
_map.IsDbTag = b
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetIsWEBTag json tag.json标记
|
// GetIsWEBTag json tag.json标记
|
||||||
func GetIsWEBTag() bool {
|
func GetIsWEBTag() bool {
|
||||||
return _map.IsWEBTag
|
return _map.IsWEBTag
|
||||||
@@ -321,8 +310,3 @@ func SetIsColumnName(isColumnName bool) {
|
|||||||
func GetIsOutFileByTableName() bool {
|
func GetIsOutFileByTableName() bool {
|
||||||
return _map.IsOutFileByTableName
|
return _map.IsOutFileByTableName
|
||||||
}
|
}
|
||||||
|
|
||||||
//SetIsOutFileByTableName set gen ColumnName config. 设置是否根据表名生成文件
|
|
||||||
func SetIsOutFileByTableName(isOutFileByTableName bool) {
|
|
||||||
_map.IsColumnName = isOutFileByTableName
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -292,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.SetIsDbTag(getBool(mp["is_db_tag"]))
|
|
||||||
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"]))
|
||||||
|
|||||||
@@ -123,8 +123,8 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
|
|||||||
tmp.SetName(getCamelName(v.Name))
|
tmp.SetName(getCamelName(v.Name))
|
||||||
tmp.SetNotes(v.Notes)
|
tmp.SetNotes(v.Notes)
|
||||||
tmp.SetType(getTypeName(v.Type, v.IsNull))
|
tmp.SetType(getTypeName(v.Type, v.IsNull))
|
||||||
// is_db_tag. 是否输出gorm标签
|
// 是否输出gorm标签
|
||||||
if config.GetIsDbTag() {
|
if len(_tagGorm) > 0 {
|
||||||
// not simple output. 默认只输出gorm主键和字段标签
|
// not simple output. 默认只输出gorm主键和字段标签
|
||||||
if !config.GetSimple() {
|
if !config.GetSimple() {
|
||||||
for _, v1 := range v.Index {
|
for _, v1 := range v.Index {
|
||||||
@@ -163,8 +163,8 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(v.Name) > 0 {
|
if len(v.Name) > 0 {
|
||||||
// is_db_tag. 是否输出gorm标签
|
// 是否输出gorm标签
|
||||||
if config.GetIsDbTag() {
|
if len(_tagGorm) > 0 {
|
||||||
// not simple output
|
// not simple output
|
||||||
if !config.GetSimple() {
|
if !config.GetSimple() {
|
||||||
tmp.AddTag(_tagGorm, "column:"+v.Name)
|
tmp.AddTag(_tagGorm, "column:"+v.Name)
|
||||||
|
|||||||
Reference in New Issue
Block a user