fix gorm.SingularTable model

修复 gorm.SingularTable 表名复数问题
This commit is contained in:
谢小军
2020-02-21 02:21:17 +08:00
parent 6b14d480f0
commit 8585c30fbd
5 changed files with 3 additions and 51 deletions

View File

@@ -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
- param:singular_table = false simple = true is_json_tag = true is_foreign_key = false

View File

@@ -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导出
- 参数:singular_table = false simple = true is_json_tag = true is_foreign_key = false