1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-28 23:34:13 +00:00

Merge pull request #642 from JessonChan/develop

ignore nil time
This commit is contained in:
slene 2014-06-17 15:25:03 +08:00
commit 8be83fe488

View File

@ -144,7 +144,11 @@ func (d *dbBase) collectFieldValue(mi *modelInfo, fi *fieldInfo, ind reflect.Val
value = field.Interface() value = field.Interface()
if t, ok := value.(time.Time); ok { if t, ok := value.(time.Time); ok {
d.ins.TimeToDB(&t, tz) d.ins.TimeToDB(&t, tz)
value = t if t.IsZero() {
value = nil
} else {
value = t
}
} }
default: default:
switch { switch {