MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / SQL

Method SQL

pkg/sql/ast/sql.go:191–210  ·  view source on GitHub ↗

SQL returns the SQL representation of this unary expression. Prefix operators (NOT, +, -, etc.) are prepended; the PostgreSQL postfix factorial operator (!) is appended.

()

Source from the content-addressed store, hash-verified

189// Prefix operators (NOT, +, -, etc.) are prepended; the PostgreSQL
190// postfix factorial operator (!) is appended.
191func (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".

Callers

nothing calls this directly

Calls 2

exprSQLFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected