mirror of https://github.com/go-gorm/gorm.git
Add OnConflict OnConstraint support, close #3882
This commit is contained in:
parent
6d260a86bd
commit
435bf70865
|
@ -1,11 +1,12 @@
|
||||||
package clause
|
package clause
|
||||||
|
|
||||||
type OnConflict struct {
|
type OnConflict struct {
|
||||||
Columns []Column
|
Columns []Column
|
||||||
Where Where
|
Where Where
|
||||||
DoNothing bool
|
OnConstraint string
|
||||||
DoUpdates Set
|
DoNothing bool
|
||||||
UpdateAll bool
|
DoUpdates Set
|
||||||
|
UpdateAll bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (OnConflict) Name() string {
|
func (OnConflict) Name() string {
|
||||||
|
@ -31,6 +32,12 @@ func (onConflict OnConflict) Build(builder Builder) {
|
||||||
builder.WriteByte(' ')
|
builder.WriteByte(' ')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if onConflict.OnConstraint != "" {
|
||||||
|
builder.WriteString("ON CONSTRAINT ")
|
||||||
|
builder.WriteString(onConflict.OnConstraint)
|
||||||
|
builder.WriteByte(' ')
|
||||||
|
}
|
||||||
|
|
||||||
if onConflict.DoNothing {
|
if onConflict.DoNothing {
|
||||||
builder.WriteString("DO NOTHING")
|
builder.WriteString("DO NOTHING")
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue