增加支持sql.NullString...Iterate方法。

This commit is contained in:
haolei 2015-07-20 11:23:29 +08:00
parent d716685a9e
commit 916367d81e
1 changed files with 9 additions and 3 deletions

View File

@ -5,6 +5,7 @@
package xorm
import (
"database/sql/driver"
"encoding/json"
"errors"
"fmt"
@ -509,6 +510,11 @@ func buildConditions(engine *Engine, table *core.Table, bean interface{},
val = engine.FormatTime(col.SQLType.Name, t)
} else if _, ok := reflect.New(fieldType).Interface().(core.Conversion); ok {
continue
} else if valNul, ok := fieldValue.Interface().(driver.Valuer); ok {
val, _ = valNul.Value()
if val == nil {
continue
}
} else {
engine.autoMapType(fieldValue)
if table, ok := engine.Tables[fieldValue.Type()]; ok {