Query returns query representation of an `UPDATE` statement.
()
| 640 | |
| 641 | // Query returns query representation of an `UPDATE` statement. |
| 642 | func (u *UpdateBuilder) Query() (string, []any) { |
| 643 | b := u.Builder.clone() |
| 644 | if len(u.prefix) > 0 { |
| 645 | b.join(u.prefix, " ") |
| 646 | b.Pad() |
| 647 | } |
| 648 | b.WriteString("UPDATE ") |
| 649 | b.writeSchema(u.schema) |
| 650 | b.Ident(u.table).WriteString(" SET ") |
| 651 | u.writeSetter(&b) |
| 652 | if u.where != nil { |
| 653 | b.WriteString(" WHERE ") |
| 654 | b.Join(u.where) |
| 655 | } |
| 656 | joinReturning(u.returning, &b) |
| 657 | joinOrder(u.order, &b) |
| 658 | if u.limit != nil { |
| 659 | b.WriteString(" LIMIT ") |
| 660 | b.WriteString(strconv.Itoa(*u.limit)) |
| 661 | } |
| 662 | return b.String(), b.args |
| 663 | } |
| 664 | |
| 665 | // writeSetter writes the "SET" clause for the UPDATE statement. |
| 666 | func (u *UpdateBuilder) writeSetter(b *Builder) { |
nothing calls this directly
no test coverage detected