修正支持sql.NullString...时AllCols()时没有更新空字段。
This commit is contained in:
parent
3189b41ec3
commit
88a0888d6d
|
@ -220,6 +220,7 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
|
||||||
requiredField := useAllCols
|
requiredField := useAllCols
|
||||||
includeNil := useAllCols
|
includeNil := useAllCols
|
||||||
lColName := strings.ToLower(col.Name)
|
lColName := strings.ToLower(col.Name)
|
||||||
|
|
||||||
if b, ok := mustColumnMap[lColName]; ok {
|
if b, ok := mustColumnMap[lColName]; ok {
|
||||||
if b {
|
if b {
|
||||||
requiredField = true
|
requiredField = true
|
||||||
|
@ -321,10 +322,8 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
val = engine.FormatTime(col.SQLType.Name, t)
|
val = engine.FormatTime(col.SQLType.Name, t)
|
||||||
} else if nulVal, ok := fieldValue.Interface().(driver.Valuer); ok {
|
} else if nulType, ok := fieldValue.Interface().(driver.Valuer); ok {
|
||||||
if val, _ = nulVal.Value(); val == nil {
|
val, _ = nulType.Value()
|
||||||
continue
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
engine.autoMapType(fieldValue)
|
engine.autoMapType(fieldValue)
|
||||||
if table, ok := engine.Tables[fieldValue.Type()]; ok {
|
if table, ok := engine.Tables[fieldValue.Type()]; ok {
|
||||||
|
|
Loading…
Reference in New Issue