diff --git a/data/view/model/model.go b/data/view/model/model.go index 1eda56e..7555dfc 100755 --- a/data/view/model/model.go +++ b/data/view/model/model.go @@ -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)