解决Conversion接口ToDB() ([]byte, error)方法返回*Type值为nil时,数据类型为[]byte(nil)的bug,解决*Type值为nil时插入数据变为""的bug
This commit is contained in:
parent
6a1dd59737
commit
a23913685e
|
@ -554,6 +554,9 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val
|
||||||
if col.SQLType.IsBlob() {
|
if col.SQLType.IsBlob() {
|
||||||
return data, nil
|
return data, nil
|
||||||
}
|
}
|
||||||
|
if nil==data {
|
||||||
|
return nil,nil
|
||||||
|
}
|
||||||
return string(data), nil
|
return string(data), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -318,9 +318,13 @@ func (statement *Statement) buildUpdates(bean interface{},
|
||||||
data, err := structConvert.ToDB()
|
data, err := structConvert.ToDB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
engine.logger.Error(err)
|
engine.logger.Error(err)
|
||||||
|
} else {
|
||||||
|
if nil==data {
|
||||||
|
val=nil
|
||||||
}else{
|
}else{
|
||||||
val = data
|
val = data
|
||||||
}
|
}
|
||||||
|
}
|
||||||
goto APPEND
|
goto APPEND
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue