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

Method SQL

pkg/sql/ast/sql.go:282–298  ·  view source on GitHub ↗

SQL returns the SQL representation of this IN expression. The NOT modifier is included when InExpression.Not is true. Supports both value lists "x IN (1, 2, 3)" and subqueries "x IN (SELECT ...)".

()

Source from the content-addressed store, hash-verified

280// The NOT modifier is included when InExpression.Not is true.
281// Supports both value lists "x IN (1, 2, 3)" and subqueries "x IN (SELECT ...)".
282func (i *InExpression) SQL() string {
283 if i == nil {
284 return ""
285 }
286 not := ""
287 if i.Not {
288 not = "NOT "
289 }
290 if i.Subquery != nil {
291 return fmt.Sprintf("%s %sIN (%s)", exprSQL(i.Expr), not, stmtSQL(i.Subquery))
292 }
293 vals := make([]string, len(i.List))
294 for idx, v := range i.List {
295 vals[idx] = exprSQL(v)
296 }
297 return fmt.Sprintf("%s %sIN (%s)", exprSQL(i.Expr), not, strings.Join(vals, ", "))
298}
299
300// SQL returns the SQL representation of this EXISTS expression as "EXISTS (subquery)".
301func (e *ExistsExpression) SQL() string {

Callers

nothing calls this directly

Calls 2

exprSQLFunction · 0.70
stmtSQLFunction · 0.70

Tested by

no test coverage detected