AppendSelectExprAs appends additional expressions to the SELECT statement with the given name.
(expr Querier, as string)
| 1796 | |
| 1797 | // AppendSelectExprAs appends additional expressions to the SELECT statement with the given name. |
| 1798 | func (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". |