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

Method SQL

pkg/sql/ast/sql.go:441–453  ·  view source on GitHub ↗

SQL returns the SQL representation of this ARRAY constructor. From a subquery: "ARRAY(SELECT ...)". From an element list: "ARRAY[e1, e2, e3]".

()

Source from the content-addressed store, hash-verified

439// From a subquery: "ARRAY(SELECT ...)".
440// From an element list: "ARRAY[e1, e2, e3]".
441func (a *ArrayConstructorExpression) SQL() string {
442 if a == nil {
443 return ""
444 }
445 if a.Subquery != nil {
446 return fmt.Sprintf("ARRAY(%s)", stmtSQL(a.Subquery))
447 }
448 vals := make([]string, len(a.Elements))
449 for i, e := range a.Elements {
450 vals[i] = exprSQL(e)
451 }
452 return "ARRAY[" + strings.Join(vals, ", ") + "]"
453}
454
455// SQL returns the SQL representation of this array subscript expression,
456// e.g. "arr[1]" or "matrix[i][j]" for multi-dimensional subscripts.

Callers 2

TestNilSQLFunction · 0.95

Calls 2

stmtSQLFunction · 0.70
exprSQLFunction · 0.70

Tested by 2

TestNilSQLFunction · 0.76