Skip to content

Commit

Permalink
Update mysql.go
Browse files Browse the repository at this point in the history
remove ON DUPLICATE KEY UPDATE statement by onConflict.DoNothing is true
  • Loading branch information
hhniao authored Sep 1, 2023
1 parent 48b6526 commit 488ab51
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mysql.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,10 @@ func (dialector Dialector) ClauseBuilders() map[string]clause.ClauseBuilder {
c.Build(builder)
return
}
// onConflict DoNothing, remove ON DUPLICATE KEY UPDATE statement
if onConflict.DoNothing {
return
}

builder.WriteString("ON DUPLICATE KEY UPDATE ")
if len(onConflict.DoUpdates) == 0 {
Expand Down

0 comments on commit 488ab51

Please sign in to comment.