MCPcopy
hub / github.com/sqlc-dev/sqlc / expandFromClause

Method expandFromClause

internal/x/expander/expander.go:290–309  ·  view source on GitHub ↗

expandFromClause expands * in subqueries within FROM clause

(ctx context.Context, node ast.Node)

Source from the content-addressed store, hash-verified

288
289// expandFromClause expands * in subqueries within FROM clause
290func (e *Expander) expandFromClause(ctx context.Context, node ast.Node) error {
291 if node == nil {
292 return nil
293 }
294
295 switch n := node.(type) {
296 case *ast.RangeSubselect:
297 if n.Subquery != nil {
298 return e.expandNode(ctx, n.Subquery)
299 }
300 case *ast.JoinExpr:
301 if err := e.expandFromClause(ctx, n.Larg); err != nil {
302 return err
303 }
304 if err := e.expandFromClause(ctx, n.Rarg); err != nil {
305 return err
306 }
307 }
308 return nil
309}
310
311// hasStarAnywhere checks if there's a * anywhere in the statement using astutils.Search
312func hasStarAnywhere(node ast.Node) bool {

Callers 2

expandSelectStmtMethod · 0.95
expandSelectStmtInnerMethod · 0.95

Calls 1

expandNodeMethod · 0.95

Tested by

no test coverage detected