MCPcopy Create free account
hub / github.com/dolthub/doltgresql / Format

Method Format

postgres/parser/sem/tree/create_aggregate.go:34–64  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

32
33// Format implements the NodeFormatter interface.
34func (node *CreateAggregate) Format(ctx *FmtCtx) {
35 ctx.WriteString("CREATE ")
36 if node.Replace {
37 ctx.WriteString("OR REPLACE ")
38 }
39 ctx.WriteString("AGGREGATE ")
40 ctx.FormatNode(node.Name)
41 ctx.WriteString(" ( ")
42 if node.OrderByArgs != nil {
43 if node.Args != nil {
44 ctx.FormatNode(node.Args)
45 }
46 ctx.WriteString(" ORDER BY ")
47 ctx.FormatNode(node.OrderByArgs)
48 ctx.WriteString(" ) ( ")
49 } else if node.Args != nil {
50 ctx.FormatNode(node.Args)
51 ctx.WriteString(" ) ( ")
52 } else {
53 ctx.WriteString("BASETYPE = ")
54 ctx.WriteString(node.BaseType.SQLString())
55 ctx.WriteString(" , ")
56 }
57 ctx.WriteString("SFUNC = ")
58 ctx.FormatNode(node.SFunc)
59 ctx.WriteString(" , STYPE = ")
60 ctx.WriteString(node.BaseType.SQLString())
61 if node.AggOptions != nil {
62 ctx.FormatNode(&node.AggOptions)
63 }
64}
65
66type FinalFuncModifyType string
67

Callers

nothing calls this directly

Calls 3

WriteStringMethod · 0.80
FormatNodeMethod · 0.80
SQLStringMethod · 0.65

Tested by

no test coverage detected