fix gorm.SingularTable model
修复 gorm.SingularTable 表名复数问题
This commit is contained in:
@@ -31,7 +31,7 @@ out_dir : "." # 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 : false # Table name plural (big Camel-Case):gorm.SingularTable
|
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
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ 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
|
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 # 是否输出 快捷函数
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ service_displayname : #服务显示名
|
|||||||
sercice_desc : #服务描述
|
sercice_desc : #服务描述
|
||||||
is_dev : false # 是否开发者模式
|
is_dev : false # 是否开发者模式
|
||||||
out_dir : ./db # 输出目录
|
out_dir : ./db # 输出目录
|
||||||
singular_table : false # 单表模式:true:禁用表名复数,false:采用表明复数 参考:gorm.SingularTable
|
singular_table : true # 单表模式:true:禁用表名复数,false:采用表明复数 参考:gorm.SingularTable
|
||||||
simple : true #简单输出
|
simple : true #简单输出
|
||||||
isJsonTag : true #是否打json标记
|
isJsonTag : true #是否打json标记
|
||||||
mysql_info:
|
mysql_info:
|
||||||
|
|||||||
@@ -58,30 +58,6 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
### Complex single table mode export
|
|
||||||
|
|
||||||
- param:singular_table = true simple = false is_foreign_key = false
|
|
||||||
|
|
||||||
###### --->export result
|
|
||||||
|
|
||||||
```
|
|
||||||
// UserAccountTbl 用户账号
|
|
||||||
type User_account_tbl struct {
|
|
||||||
Id int `gorm:"primary_key;column:id;type:int(11);not null" json:"-"`
|
|
||||||
Account string `gorm:"unique;column:account;type:varchar(64);not null" json:"account"`
|
|
||||||
Password string `gorm:"column:password;type:varchar(64);not null" json:"password"`
|
|
||||||
Account_type int `gorm:"column:account_type;type:int(11);not null" json:"account_type"` // 帐号类型:0手机号,1邮件
|
|
||||||
App_key string `gorm:"unique_index:UNIQ_5696AD037D3656A4;column:app_key;type:varchar(255);not null" json:"app_key"` // authbucket_oauth2_client表的id
|
|
||||||
User_info_tbl_id int `gorm:"unique_index:UNIQ_5696AD037D3656A4;index;column:user_info_tbl_id;type:int(11);not null" json:"user_info_tbl_id"`
|
|
||||||
Reg_time time.Time `gorm:"column:reg_time;type:datetime" json:"reg_time"`
|
|
||||||
Reg_ip string `gorm:"column:reg_ip;type:varchar(15)" json:"reg_ip"`
|
|
||||||
Bundle_id string `gorm:"column:bundle_id;type:varchar(255)" json:"bundle_id"`
|
|
||||||
Describ string `gorm:"column:describ;type:varchar(255)" json:"describ"`
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
-------------
|
|
||||||
|
|
||||||
### Simple-export-with-JSON
|
### Simple-export-with-JSON
|
||||||
|
|
||||||
- param:singular_table = false simple = true is_json_tag = true is_foreign_key = false
|
- param:singular_table = false simple = true is_json_tag = true is_foreign_key = false
|
||||||
|
|||||||
@@ -58,30 +58,6 @@ type UserAccountTbl struct {
|
|||||||
|
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
### 复杂单表模式导出
|
|
||||||
|
|
||||||
- 参数:singular_table = true simple = false is_foreign_key = false
|
|
||||||
|
|
||||||
###### --->导出结果
|
|
||||||
|
|
||||||
```
|
|
||||||
// UserAccountTbl 用户账号
|
|
||||||
type User_account_tbl struct {
|
|
||||||
Id int `gorm:"primary_key;column:id;type:int(11);not null" json:"-"`
|
|
||||||
Account string `gorm:"unique;column:account;type:varchar(64);not null" json:"account"`
|
|
||||||
Password string `gorm:"column:password;type:varchar(64);not null" json:"password"`
|
|
||||||
Account_type int `gorm:"column:account_type;type:int(11);not null" json:"account_type"` // 帐号类型:0手机号,1邮件
|
|
||||||
App_key string `gorm:"unique_index:UNIQ_5696AD037D3656A4;column:app_key;type:varchar(255);not null" json:"app_key"` // authbucket_oauth2_client表的id
|
|
||||||
User_info_tbl_id int `gorm:"unique_index:UNIQ_5696AD037D3656A4;index;column:user_info_tbl_id;type:int(11);not null" json:"user_info_tbl_id"`
|
|
||||||
Reg_time time.Time `gorm:"column:reg_time;type:datetime" json:"reg_time"`
|
|
||||||
Reg_ip string `gorm:"column:reg_ip;type:varchar(15)" json:"reg_ip"`
|
|
||||||
Bundle_id string `gorm:"column:bundle_id;type:varchar(255)" json:"bundle_id"`
|
|
||||||
Describ string `gorm:"column:describ;type:varchar(255)" json:"describ"`
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
-------------
|
|
||||||
|
|
||||||
### 简单带json导出
|
### 简单带json导出
|
||||||
|
|
||||||
- 参数:singular_table = false simple = true is_json_tag = true is_foreign_key = false
|
- 参数:singular_table = false simple = true is_json_tag = true is_foreign_key = false
|
||||||
|
|||||||
Reference in New Issue
Block a user