Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 45 | |
| 46 | // Format implements the NodeFormatter interface. |
| 47 | func (node *CreateDatabase) Format(ctx *FmtCtx) { |
| 48 | ctx.WriteString("CREATE DATABASE ") |
| 49 | if node.IfNotExists { |
| 50 | ctx.WriteString("IF NOT EXISTS ") |
| 51 | } |
| 52 | ctx.FormatNode(&node.Name) |
| 53 | if node.Template != "" { |
| 54 | ctx.WriteString(" TEMPLATE = ") |
| 55 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Template, ctx.flags.EncodeFlags()) |
| 56 | } |
| 57 | if node.Encoding != "" { |
| 58 | ctx.WriteString(" ENCODING = ") |
| 59 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Encoding, ctx.flags.EncodeFlags()) |
| 60 | } |
| 61 | if node.Collate != "" { |
| 62 | ctx.WriteString(" LC_COLLATE = ") |
| 63 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Collate, ctx.flags.EncodeFlags()) |
| 64 | } |
| 65 | if node.CType != "" { |
| 66 | ctx.WriteString(" LC_CTYPE = ") |
| 67 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.CType, ctx.flags.EncodeFlags()) |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | // IndexElem represents a column with a direction in a CREATE INDEX statement. |
| 72 | type IndexElem struct { |
nothing calls this directly
no test coverage detected