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

Method convertSelectStmt

internal/engine/dolphin/convert.go:563–587  ·  view source on GitHub ↗
(n *pcast.SelectStmt)

Source from the content-addressed store, hash-verified

561}
562
563func (c *cc) convertSelectStmt(n *pcast.SelectStmt) *ast.SelectStmt {
564 windowClause := &ast.List{Items: make([]ast.Node, 0)}
565 orderByClause := c.convertOrderByClause(n.OrderBy)
566 if orderByClause != nil {
567 windowClause.Items = append(windowClause.Items, orderByClause)
568 }
569
570 op, all := c.convertSetOprType(n.AfterSetOperator)
571 stmt := &ast.SelectStmt{
572 TargetList: c.convertFieldList(n.Fields),
573 FromClause: c.convertTableRefsClause(n.From),
574 GroupClause: c.convertGroupByClause(n.GroupBy),
575 HavingClause: c.convertHavingClause(n.Having),
576 WhereClause: c.convert(n.Where),
577 WithClause: c.convertWithClause(n.With),
578 WindowClause: windowClause,
579 Op: op,
580 All: all,
581 }
582 if n.Limit != nil {
583 stmt.LimitCount = c.convert(n.Limit.Count)
584 stmt.LimitOffset = c.convert(n.Limit.Offset)
585 }
586 return stmt
587}
588
589func (c *cc) convertSubqueryExpr(n *pcast.SubqueryExpr) ast.Node {
590 // Wrap subquery in SubLink to ensure parentheses are added

Callers 2

convertMethod · 0.95

Calls 8

convertOrderByClauseMethod · 0.95
convertSetOprTypeMethod · 0.95
convertFieldListMethod · 0.95
convertGroupByClauseMethod · 0.95
convertHavingClauseMethod · 0.95
convertMethod · 0.95
convertWithClauseMethod · 0.95

Tested by

no test coverage detected