| 554 | } |
| 555 | |
| 556 | func (node *SelectClause) docTable(p *PrettyCfg) []pretty.TableRow { |
| 557 | if node.TableSelect { |
| 558 | return []pretty.TableRow{p.row("TABLE", p.Doc(node.From.Tables[0]))} |
| 559 | } |
| 560 | exprs := node.Exprs.doc(p) |
| 561 | if node.Distinct { |
| 562 | if node.DistinctOn != nil { |
| 563 | exprs = pretty.ConcatLine(p.Doc(&node.DistinctOn), exprs) |
| 564 | } else { |
| 565 | exprs = pretty.ConcatLine(pretty.Keyword("DISTINCT"), exprs) |
| 566 | } |
| 567 | } |
| 568 | return []pretty.TableRow{ |
| 569 | p.row("SELECT", exprs), |
| 570 | node.From.docRow(p), |
| 571 | node.Where.docRow(p), |
| 572 | node.GroupBy.docRow(p), |
| 573 | node.Having.docRow(p), |
| 574 | node.Window.docRow(p), |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | func (node *From) doc(p *PrettyCfg) pretty.Doc { |
| 579 | return p.unrow(node.docRow(p)) |