MCPcopy
hub / github.com/ent/ent / Query

Method Query

dialect/sql/builder.go:2747–2768  ·  view source on GitHub ↗

Query returns query representation of a `WITH` clause.

()

Source from the content-addressed store, hash-verified

2745
2746// Query returns query representation of a `WITH` clause.
2747func (w *WithBuilder) Query() (string, []any) {
2748 w.WriteString("WITH ")
2749 if w.recursive {
2750 w.WriteString("RECURSIVE ")
2751 }
2752 for i, cte := range w.ctes {
2753 if i > 0 {
2754 w.Comma()
2755 }
2756 w.Ident(cte.name)
2757 if len(cte.columns) > 0 {
2758 w.WriteByte('(')
2759 w.IdentComma(cte.columns...)
2760 w.WriteByte(')')
2761 }
2762 w.WriteString(" AS ")
2763 w.Wrap(func(b *Builder) {
2764 b.Join(cte.s)
2765 })
2766 }
2767 return w.String(), w.args
2768}
2769
2770// implement the table view interface.
2771func (*WithBuilder) view() {}

Callers

nothing calls this directly

Calls 8

WriteStringMethod · 0.80
CommaMethod · 0.80
IdentMethod · 0.80
WriteByteMethod · 0.80
IdentCommaMethod · 0.80
WrapMethod · 0.80
JoinMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected