8be83fe4 by slene

Merge pull request #642 from JessonChan/develop

ignore nil time
2 parents cff632f5 06f4bf49
...@@ -144,8 +144,12 @@ func (d *dbBase) collectFieldValue(mi *modelInfo, fi *fieldInfo, ind reflect.Val ...@@ -144,8 +144,12 @@ func (d *dbBase) collectFieldValue(mi *modelInfo, fi *fieldInfo, ind reflect.Val
144 value = field.Interface() 144 value = field.Interface()
145 if t, ok := value.(time.Time); ok { 145 if t, ok := value.(time.Time); ok {
146 d.ins.TimeToDB(&t, tz) 146 d.ins.TimeToDB(&t, tz)
147 if t.IsZero() {
148 value = nil
149 } else {
147 value = t 150 value = t
148 } 151 }
152 }
149 default: 153 default:
150 switch { 154 switch {
151 case fi.fieldType&IsPostiveIntegerField > 0: 155 case fi.fieldType&IsPostiveIntegerField > 0:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!