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

Method Format

pkg/sql/sem/tree/comment_on_table.go:17–32  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

15
16// Format implements the NodeFormatter interface.
17func (n *CommentOnTable) Format(ctx *FmtCtx) {
18 ctx.WriteString("COMMENT ON TABLE ")
19 ctx.FormatNode(n.Table)
20 ctx.WriteString(" IS ")
21 if n.Comment != nil {
22 // TODO(knz): Replace all this with ctx.FormatNode
23 // when COMMENT supports expressions.
24 if ctx.flags.HasFlags(FmtHideConstants) {
25 ctx.WriteString("'_'")
26 } else {
27 lexbase.EncodeSQLStringWithFlags(&ctx.Buffer, *n.Comment, ctx.flags.EncodeFlags())
28 }
29 } else {
30 ctx.WriteString("NULL")
31 }
32}

Callers

nothing calls this directly

Calls 4

EncodeSQLStringWithFlagsFunction · 0.92
FormatNodeMethod · 0.80
EncodeFlagsMethod · 0.80
HasFlagsMethod · 0.45

Tested by

no test coverage detected