Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 20 | |
| 21 | // Format implements the NodeFormatter interface. |
| 22 | func (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 | } |
nothing calls this directly
no test coverage detected