From 4d6b70ec88dbff3d4a5e43b284c7b5b624915844 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Thu, 2 Feb 2023 17:15:08 +0800 Subject: [PATCH] Allow modify statement from dest --- callbacks.go | 4 ++++ clause/clause.go | 1 + 2 files changed, 5 insertions(+) diff --git a/callbacks.go b/callbacks.go index ebebf79d..de979e45 100644 --- a/callbacks.go +++ b/callbacks.go @@ -93,6 +93,10 @@ func (p *processor) Execute(db *DB) *DB { resetBuildClauses = true } + if optimizer, ok := db.Statement.Dest.(StatementModifier); ok { + optimizer.ModifyStatement(stmt) + } + // assign model values if stmt.Model == nil { stmt.Model = stmt.Dest diff --git a/clause/clause.go b/clause/clause.go index de19f2e3..1354fc05 100644 --- a/clause/clause.go +++ b/clause/clause.go @@ -20,6 +20,7 @@ type Builder interface { Writer WriteQuoted(field interface{}) AddVar(Writer, ...interface{}) + AddError(error) error } // Clause