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

Method Format

pkg/sql/sem/tree/set.go:28–60  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

26
27// Format implements the NodeFormatter interface.
28func (node *SetVar) Format(ctx *FmtCtx) {
29 if node.ResetAll {
30 ctx.WriteString("RESET ALL")
31 return
32 }
33 if node.Reset {
34 ctx.WriteString("RESET ")
35 ctx.WithFlags(ctx.flags & ^FmtAnonymize & ^FmtMarkRedactionNode, func() {
36 // Session var names never contain PII and should be distinguished
37 // for feature tracking purposes.
38 ctx.FormatNameP(&node.Name)
39 })
40 return
41 }
42 ctx.WriteString("SET ")
43 if node.Local {
44 ctx.WriteString("LOCAL ")
45 }
46 if node.SetRow {
47 ctx.WriteString("ROW (")
48 ctx.FormatNode(&node.Values)
49 ctx.WriteString(")")
50 } else {
51 ctx.WithFlags(ctx.flags & ^FmtAnonymize & ^FmtMarkRedactionNode, func() {
52 // Session var names never contain PII and should be distinguished
53 // for feature tracking purposes.
54 ctx.FormatNameP(&node.Name)
55 })
56
57 ctx.WriteString(" = ")
58 ctx.FormatNode(&node.Values)
59 }
60}
61
62// SetClusterSetting represents a SET CLUSTER SETTING statement.
63type SetClusterSetting struct {

Callers

nothing calls this directly

Calls 3

WithFlagsMethod · 0.80
FormatNamePMethod · 0.80
FormatNodeMethod · 0.80

Tested by

no test coverage detected