SetExcluded sets the column name to its EXCLUDED/VALUES value. For example, "c" = "excluded"."c", or `c` = VALUES(`c`).
(name string)
| 420 | // SetExcluded sets the column name to its EXCLUDED/VALUES value. |
| 421 | // For example, "c" = "excluded"."c", or `c` = VALUES(`c`). |
| 422 | func (u *UpdateSet) SetExcluded(name string) *UpdateSet { |
| 423 | switch u.UpdateBuilder.Dialect() { |
| 424 | case dialect.MySQL: |
| 425 | u.UpdateBuilder.Set(name, ExprFunc(func(b *Builder) { |
| 426 | b.WriteString("VALUES(").Ident(name).WriteByte(')') |
| 427 | })) |
| 428 | default: |
| 429 | t := Dialect(u.UpdateBuilder.dialect).Table("excluded") |
| 430 | u.UpdateBuilder.Set(name, Expr(t.C(name))) |
| 431 | } |
| 432 | return u |
| 433 | } |
| 434 | |
| 435 | // Query returns query representation of an `INSERT INTO` statement. |
| 436 | func (i *InsertBuilder) Query() (string, []any) { |