Merge pull request #192 from jiang4869/master

当字段默认值为NULL,并且结构不设置为指针时,添加default:null的tag
master
xxj 3 years ago committed by GitHub
commit ce6259fb05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -184,7 +184,10 @@ func (m *_Model) genTableElement(cols []ColumnsInfo) (el []genstruct.GenElement)
tmp.AddTag(_tagGorm, "type:"+v.Type)
if !v.IsNull {
tmp.AddTag(_tagGorm, "not null")
}
} else if v.IsNull && !config.GetIsNullToPoint() {
// 当该字段默认值为null并且结构不用指针类型时添加default:null的tag
tmp.AddTag(_tagGorm,"default:null")
}
// default tag
if len(v.Gormt) > 0 {
tmp.AddTag(_tagGorm, v.Gormt)

Loading…
Cancel
Save