MCPcopy
hub / github.com/ent/ent / AppendSelectExprAs

Method AppendSelectExprAs

dialect/sql/builder.go:1798–1810  ·  view source on GitHub ↗

AppendSelectExprAs appends additional expressions to the SELECT statement with the given name.

(expr Querier, as string)

Source from the content-addressed store, hash-verified

1796
1797// AppendSelectExprAs appends additional expressions to the SELECT statement with the given name.
1798func (s *Selector) AppendSelectExprAs(expr Querier, as string) *Selector {
1799 x := expr
1800 if _, ok := expr.(*raw); !ok {
1801 x = ExprFunc(func(b *Builder) {
1802 b.S("(").Join(expr).S(")")
1803 })
1804 }
1805 s.selection = append(s.selection, selection{
1806 x: x,
1807 as: as,
1808 })
1809 return s
1810}
1811
1812// FindSelection returns all occurrences in the selection that match the given column name.
1813// For example, for column "a" the following match: a, "a", "t"."a", "t"."b" AS "a".

Callers 7

limitRowsFunction · 0.80
TestWindowFunctionFunction · 0.80
selectTermsFunction · 0.80
ModifierMethod · 0.80

Calls 3

ExprFuncFunction · 0.85
SMethod · 0.80
JoinMethod · 0.45

Tested by 5

limitRowsFunction · 0.64
TestWindowFunctionFunction · 0.64