MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / doc

Method doc

pkg/sql/sem/tree/pretty.go:731–776  ·  view source on GitHub ↗
(p *PrettyCfg)

Source from the content-addressed store, hash-verified

729}
730
731func (node *FuncExpr) doc(p *PrettyCfg) pretty.Doc {
732 d := p.Doc(&node.Func)
733
734 if len(node.Exprs) > 0 {
735 args := node.Exprs.doc(p)
736 if node.Type != 0 {
737 args = pretty.ConcatLine(
738 pretty.Text(funcTypeName[node.Type]),
739 args,
740 )
741 }
742
743 if node.AggType == GeneralAgg && len(node.OrderBy) > 0 {
744 args = pretty.ConcatSpace(args, node.OrderBy.doc(p))
745 }
746 d = pretty.Concat(d, p.bracket("(", args, ")"))
747 } else {
748 d = pretty.Concat(d, pretty.Text("()"))
749 }
750 if node.AggType == OrderedSetAgg && len(node.OrderBy) > 0 {
751 args := node.OrderBy.doc(p)
752 d = pretty.Concat(d, p.bracket("WITHIN GROUP (", args, ")"))
753 }
754 if node.Filter != nil {
755 d = pretty.Fold(pretty.ConcatSpace,
756 d,
757 pretty.Keyword("FILTER"),
758 p.bracket("(",
759 p.nestUnder(pretty.Keyword("WHERE"), p.Doc(node.Filter)),
760 ")"))
761 }
762 if window := node.WindowDef; window != nil {
763 var over pretty.Doc
764 if window.Name != "" {
765 over = p.Doc(&window.Name)
766 } else {
767 over = p.Doc(window)
768 }
769 d = pretty.Fold(pretty.ConcatSpace,
770 d,
771 pretty.Keyword("OVER"),
772 over,
773 )
774 }
775 return d
776}
777
778func (node *WindowDef) doc(p *PrettyCfg) pretty.Doc {
779 rows := make([]pretty.TableRow, 0, 4)

Callers

nothing calls this directly

Calls 10

ConcatLineFunction · 0.92
TextFunction · 0.92
ConcatSpaceFunction · 0.92
ConcatFunction · 0.92
FoldFunction · 0.92
KeywordFunction · 0.92
DocMethod · 0.80
bracketMethod · 0.80
nestUnderMethod · 0.80
docMethod · 0.65

Tested by

no test coverage detected