fix: for time.Time field, when time is zero and db field has default value, then return nil to use db default value

This commit is contained in:
nanyan 2018-12-04 18:04:21 +08:00
parent b07c406703
commit 75e384df91
1 changed files with 1 additions and 1 deletions

View File

@ -1547,7 +1547,7 @@ func (engine *Engine) nowTime(col *core.Column) (interface{}, time.Time) {
func (engine *Engine) formatColTime(col *core.Column, t time.Time) (v interface{}) { func (engine *Engine) formatColTime(col *core.Column, t time.Time) (v interface{}) {
if t.IsZero() { if t.IsZero() {
if col.Nullable { if col.Nullable || !col.DefaultIsEmpty {
return nil return nil
} }
return "" return ""