From d6ae1919c220d8758a463ac25f864e256ac8576f Mon Sep 17 00:00:00 2001 From: liutianqi Date: Fri, 12 Jan 2024 16:01:15 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=20UPDATE=20?= =?UTF-8?q?=E5=AD=90=E5=8F=A5=E6=95=B0=E6=8D=AE=E6=9C=AA=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=80=BC=E7=B1=BB=E5=9E=8B=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liutianqi --- update.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/update.go b/update.go index a4af974..9711ec1 100644 --- a/update.go +++ b/update.go @@ -48,6 +48,10 @@ func Update(config *callbacks.Config) func(db *gorm.DB) { checkMissingWhereConditions(db) if !db.DryRun && db.Error == nil { + for i, val := range stmt.Vars { + // HACK: replace values one by one, assuming its value layout will be the same all the time, i.e. aligned + stmt.Vars[i] = convertValue(val) + } if ok, mode := hasReturning(db, supportReturning); ok { if rows, err := stmt.ConnPool.QueryContext(stmt.Context, stmt.SQL.String(), stmt.Vars...); db.AddError(err) == nil { dest := stmt.Dest