| 595 | } |
| 596 | |
| 597 | func (node *SelectClause) docTable(p *PrettyCfg) []pretty.TableRow { |
| 598 | if node.TableSelect { |
| 599 | return []pretty.TableRow{p.row("TABLE", p.Doc(node.From.Tables[0]))} |
| 600 | } |
| 601 | exprs := node.Exprs.doc(p) |
| 602 | if node.Distinct { |
| 603 | if node.DistinctOn != nil { |
| 604 | exprs = pretty.ConcatLine(p.Doc(&node.DistinctOn), exprs) |
| 605 | } else { |
| 606 | exprs = pretty.ConcatLine(pretty.Keyword("DISTINCT"), exprs) |
| 607 | } |
| 608 | } |
| 609 | return []pretty.TableRow{ |
| 610 | p.row("SELECT", exprs), |
| 611 | node.From.docRow(p), |
| 612 | node.Where.docRow(p), |
| 613 | node.GroupBy.docRow(p), |
| 614 | node.Having.docRow(p), |
| 615 | node.Window.docRow(p), |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | func (node *From) doc(p *PrettyCfg) pretty.Doc { |
| 620 | return p.unrow(node.docRow(p)) |