Source File
on_conflict.go
Belonging Package
gorm.io/gorm/clause
package clausetype OnConflict struct {Columns []ColumnWhere WhereTargetWhere WhereOnConstraint stringDoNothing boolDoUpdates SetUpdateAll bool}func (OnConflict) () string {return "ON CONFLICT"}// Build build onConflict clausefunc ( OnConflict) ( Builder) {if .OnConstraint != "" {.WriteString("ON CONSTRAINT ").WriteString(.OnConstraint).WriteByte(' ')} else {if len(.Columns) > 0 {.WriteByte('(')for , := range .Columns {if > 0 {.WriteByte(',')}.WriteQuoted()}.WriteString(`) `)}if len(.TargetWhere.Exprs) > 0 {.WriteString(" WHERE ").TargetWhere.Build().WriteByte(' ')}}if .DoNothing {.WriteString("DO NOTHING")} else {.WriteString("DO UPDATE SET ").DoUpdates.Build()}if len(.Where.Exprs) > 0 {.WriteString(" WHERE ").Where.Build().WriteByte(' ')}}// MergeClause merge onConflict clausesfunc ( OnConflict) ( *Clause) {.Expression =}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |