SQL returns the SQL representation of this ARRAY constructor. From a subquery: "ARRAY(SELECT ...)". From an element list: "ARRAY[e1, e2, e3]".
()
| 439 | // From a subquery: "ARRAY(SELECT ...)". |
| 440 | // From an element list: "ARRAY[e1, e2, e3]". |
| 441 | func (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. |