Skip to content
This repository has been archived by the owner on Sep 7, 2021. It is now read-only.
This repository is currently being migrated. It's locked while the migration is in progress.

解决Conversion接口ToDB() ([]byte, error)方法返回*Type值为nil时,数据类型为[]byte(nil)的… #1296

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions session_convert.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,9 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val
if col.SQLType.IsBlob() {
return data, nil
}
if nil==data {
return nil,nil
}
return string(data), nil
}

Expand Down
6 changes: 5 additions & 1 deletion statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,11 @@ func (statement *Statement) buildUpdates(bean interface{},
if err != nil {
engine.logger.Error(err)
} else {
val = data
if nil==data {
val=nil
}else{
val = data
}
}
goto APPEND
}
Expand Down