Allow modify statement from dest

This commit is contained in:
Jinzhu 2023-02-02 17:15:08 +08:00
parent cfbcedbf03
commit 4d6b70ec88
2 changed files with 5 additions and 0 deletions

View File

@ -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

View File

@ -20,6 +20,7 @@ type Builder interface {
Writer
WriteQuoted(field interface{})
AddVar(Writer, ...interface{})
AddError(error) error
}
// Clause