Skip to content

Commit d6ae191

Browse files
committed
🐛 修复 UPDATE 子句数据未处理值类型的问题
Signed-off-by: liutianqi <zixizixi@vip.qq.com>
1 parent afff9b8 commit d6ae191

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

update.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ func Update(config *callbacks.Config) func(db *gorm.DB) {
4848
checkMissingWhereConditions(db)
4949

5050
if !db.DryRun && db.Error == nil {
51+
for i, val := range stmt.Vars {
52+
// HACK: replace values one by one, assuming its value layout will be the same all the time, i.e. aligned
53+
stmt.Vars[i] = convertValue(val)
54+
}
5155
if ok, mode := hasReturning(db, supportReturning); ok {
5256
if rows, err := stmt.ConnPool.QueryContext(stmt.Context, stmt.SQL.String(), stmt.Vars...); db.AddError(err) == nil {
5357
dest := stmt.Dest

0 commit comments

Comments
 (0)