Skip to content

Commit

Permalink
Allow modify statement from dest
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Feb 2, 2023
1 parent cfbcedb commit 4d6b70e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions clause/clause.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type Builder interface {
Writer
WriteQuoted(field interface{})
AddVar(Writer, ...interface{})
AddError(error) error
}

// Clause
Expand Down

0 comments on commit 4d6b70e

Please sign in to comment.