add autoIncrement:true
autoIncrement:true
This commit is contained in:
@@ -39,7 +39,6 @@ type TabInfo struct {
|
|||||||
type ColumnsInfo struct {
|
type ColumnsInfo struct {
|
||||||
BaseInfo
|
BaseInfo
|
||||||
IsNull bool // null if db is set null
|
IsNull bool // null if db is set null
|
||||||
Extra string // Extra (AUTO_INCREMENT 自增加)
|
|
||||||
Type string // Type.类型标记
|
Type string // Type.类型标记
|
||||||
Gormt string // 默认值
|
Gormt string // 默认值
|
||||||
Index []KList // index list.index列表
|
Index []KList // index list.index列表
|
||||||
@@ -118,7 +117,7 @@ type funDef struct {
|
|||||||
Em []EmInfo // index 列表
|
Em []EmInfo // index 列表
|
||||||
Primary []FList // primary unique
|
Primary []FList // primary unique
|
||||||
Index []FList // index
|
Index []FList // index
|
||||||
IsOutPage bool // 是否开启分页
|
IsOutPage bool // 是否开启分页
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ type genColumns struct {
|
|||||||
Key string `gorm:"column:Key"`
|
Key string `gorm:"column:Key"`
|
||||||
Desc string `gorm:"column:Comment"`
|
Desc string `gorm:"column:Comment"`
|
||||||
Null string `gorm:"column:Null"`
|
Null string `gorm:"column:Null"`
|
||||||
Extra string `gorm:"Extra"`
|
|
||||||
Default *string `gorm:"column:Default"`
|
Default *string `gorm:"column:Default"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -153,7 +153,6 @@ func (m *mysqlModel) getTableElement(orm *mysqldb.MySqlDB, tab string) (el []mod
|
|||||||
var tmp model.ColumnsInfo
|
var tmp model.ColumnsInfo
|
||||||
tmp.Name = v.Field
|
tmp.Name = v.Field
|
||||||
tmp.Type = v.Type
|
tmp.Type = v.Type
|
||||||
tmp.Extra = v.Extra
|
|
||||||
FixNotes(&tmp, v.Desc) // 分析表注释
|
FixNotes(&tmp, v.Desc) // 分析表注释
|
||||||
|
|
||||||
if v.Default != nil {
|
if v.Default != nil {
|
||||||
|
|||||||
@@ -140,9 +140,6 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
|
|||||||
if len(_tagGorm) > 0 {
|
if len(_tagGorm) > 0 {
|
||||||
// not simple output. 默认只输出gorm主键和字段标签
|
// not simple output. 默认只输出gorm主键和字段标签
|
||||||
if !config.GetSimple() {
|
if !config.GetSimple() {
|
||||||
if strings.EqualFold(v.Extra, "auto_increment") {
|
|
||||||
tmp.AddTag(_tagGorm, "autoIncrement:true")
|
|
||||||
}
|
|
||||||
for _, v1 := range v.Index {
|
for _, v1 := range v.Index {
|
||||||
switch v1.Key {
|
switch v1.Key {
|
||||||
// case ColumnsKeyDefault:
|
// case ColumnsKeyDefault:
|
||||||
|
|||||||
Reference in New Issue
Block a user