| 567 | } |
| 568 | |
| 569 | func (node *SelectClause) docTable(p *PrettyCfg) []pretty.TableRow { |
| 570 | if node.TableSelect { |
| 571 | return []pretty.TableRow{p.row("TABLE", p.Doc(node.From.Tables[0]))} |
| 572 | } |
| 573 | exprs := node.Exprs.doc(p) |
| 574 | if node.Distinct { |
| 575 | if node.DistinctOn != nil { |
| 576 | exprs = pretty.ConcatLine(p.Doc(&node.DistinctOn), exprs) |
| 577 | } else { |
| 578 | exprs = pretty.ConcatLine(pretty.Keyword("DISTINCT"), exprs) |
| 579 | } |
| 580 | } |
| 581 | return []pretty.TableRow{ |
| 582 | p.row("SELECT", exprs), |
| 583 | node.From.docRow(p), |
| 584 | node.Where.docRow(p), |
| 585 | node.GroupBy.docRow(p), |
| 586 | node.Having.docRow(p), |
| 587 | node.Window.docRow(p), |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | func (node *From) doc(p *PrettyCfg) pretty.Doc { |
| 592 | return p.unrow(node.docRow(p)) |