SQL returns the SQL representation of this unary expression. Prefix operators (NOT, +, -, etc.) are prepended; the PostgreSQL postfix factorial operator (!) is appended.
()
| 189 | // Prefix operators (NOT, +, -, etc.) are prepended; the PostgreSQL |
| 190 | // postfix factorial operator (!) is appended. |
| 191 | func (u *UnaryExpression) SQL() string { |
| 192 | if u == nil { |
| 193 | return "" |
| 194 | } |
| 195 | inner := exprSQL(u.Expr) |
| 196 | switch u.Operator { |
| 197 | case Not: |
| 198 | return "NOT " + inner |
| 199 | case PGPostfixFactorial: |
| 200 | return inner + "!" |
| 201 | case Plus: |
| 202 | return "+" + inner |
| 203 | case Minus: |
| 204 | return "-" + inner |
| 205 | case Prior: |
| 206 | return "PRIOR " + inner |
| 207 | default: |
| 208 | return u.Operator.String() + inner |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | // SQL returns the SQL representation of this aliased expression in the form |
| 213 | // "expr AS alias". |