修正支持sql.NullString字段时,使用Iterater方法时崩溃

This commit is contained in:
haolei 2015-07-20 14:13:13 +08:00
parent 916367d81e
commit 3189b41ec3
1 changed files with 4 additions and 0 deletions

View File

@ -321,6 +321,10 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
continue
}
val = engine.FormatTime(col.SQLType.Name, t)
} else if nulVal, ok := fieldValue.Interface().(driver.Valuer); ok {
if val, _ = nulVal.Value(); val == nil {
continue
}
} else {
engine.autoMapType(fieldValue)
if table, ok := engine.Tables[fieldValue.Type()]; ok {