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

Method Format

pkg/sql/sem/tree/import.go:22–65  ·  view source on GitHub ↗

Format implements the NodeFormatter interface.

(ctx *FmtCtx)

Source from the content-addressed store, hash-verified

20
21// Format implements the NodeFormatter interface.
22func (node *Import) Format(ctx *FmtCtx) {
23 ctx.WriteString("IMPORT ")
24
25 if node.Bundle {
26 if node.Table != nil {
27 ctx.WriteString("TABLE ")
28 ctx.FormatNode(node.Table)
29 ctx.WriteString(" FROM ")
30 }
31 ctx.WriteString(node.FileFormat)
32 ctx.WriteByte(' ')
33 ctx.FormatURIs(node.Files)
34 } else {
35 if node.Into {
36 ctx.WriteString("INTO ")
37 ctx.FormatNode(node.Table)
38 if node.IntoCols != nil {
39 ctx.WriteByte('(')
40 ctx.FormatNode(&node.IntoCols)
41 ctx.WriteString(") ")
42 } else {
43 ctx.WriteString(" ")
44 }
45 } else {
46 ctx.WriteString("TABLE ")
47 ctx.FormatNode(node.Table)
48 }
49 ctx.WriteString(node.FileFormat)
50 ctx.WriteString(" DATA ")
51 if len(node.Files) == 1 {
52 ctx.WriteString("(")
53 }
54 ctx.FormatURIs(node.Files)
55 if len(node.Files) == 1 {
56 ctx.WriteString(")")
57 }
58 }
59
60 if node.Options != nil {
61 ctx.WriteString(" WITH OPTIONS (")
62 ctx.FormatNode(&node.Options)
63 ctx.WriteString(")")
64 }
65}

Callers

nothing calls this directly

Calls 2

FormatNodeMethod · 0.80
FormatURIsMethod · 0.80

Tested by

no test coverage detected