Update model.go

master
xxj 3 years ago
parent ce6259fb05
commit d744f25b88

@ -186,8 +186,8 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
tmp.AddTag(_tagGorm, "not null")
} else if v.IsNull && !config.GetIsNullToPoint() {
// 当该字段默认值为null并且结构不用指针类型时添加default:null的tag
tmp.AddTag(_tagGorm,"default:null")
}
tmp.AddTag(_tagGorm, "default:null")
}
// default tag
if len(v.Gormt) > 0 {
tmp.AddTag(_tagGorm, v.Gormt)
@ -246,6 +246,7 @@ func (m *_Model) genForeignKey(col ColumnsInfo) (fklist []genstruct.GenElement)
tmp.AddTag(_tagGorm, "joinForeignKey:"+col.Name) // association_foreignkey
tmp.AddTag(_tagGorm, "foreignKey:"+v.ColumnName)
tmp.AddTag(_tagGorm, "references:"+getCamelName(col.Name))
// json tag
if config.GetIsWEBTag() {

Loading…
Cancel
Save