当字段默认值为NULL,并且结构不设置为指针时,添加default:null的tag
This commit is contained in:
@@ -184,6 +184,9 @@ 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 {
|
||||
|
||||
Reference in New Issue
Block a user