mirror of
https://github.com/astaxie/beego.git
synced 2024-11-22 17:30:56 +00:00
ignore nil time
This commit is contained in:
parent
fdb5672b7a
commit
06f4bf493d
@ -144,8 +144,12 @@ func (d *dbBase) collectFieldValue(mi *modelInfo, fi *fieldInfo, ind reflect.Val
|
||||
value = field.Interface()
|
||||
if t, ok := value.(time.Time); ok {
|
||||
d.ins.TimeToDB(&t, tz)
|
||||
if t.IsZero() {
|
||||
value = nil
|
||||
} else {
|
||||
value = t
|
||||
}
|
||||
}
|
||||
default:
|
||||
switch {
|
||||
case fi.fieldType&IsPostiveIntegerField > 0:
|
||||
|
Loading…
Reference in New Issue
Block a user