MCPcopy Index your code
hub / github.com/ent/ent / Query

Method Query

dialect/sql/builder.go:642–663  ·  view source on GitHub ↗

Query returns query representation of an `UPDATE` statement.

()

Source from the content-addressed store, hash-verified

640
641// Query returns query representation of an `UPDATE` statement.
642func (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.
666func (u *UpdateBuilder) writeSetter(b *Builder) {

Callers

nothing calls this directly

Calls 11

writeSetterMethod · 0.95
joinReturningFunction · 0.85
joinOrderFunction · 0.85
PadMethod · 0.80
WriteStringMethod · 0.80
writeSchemaMethod · 0.80
IdentMethod · 0.80
cloneMethod · 0.45
joinMethod · 0.45
JoinMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected