Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 63 | |
| 64 | // Format implements the NodeFormatter interface. |
| 65 | func (node *CreateDatabase) Format(ctx *FmtCtx) { |
| 66 | ctx.WriteString("CREATE DATABASE ") |
| 67 | if node.IfNotExists { |
| 68 | ctx.WriteString("IF NOT EXISTS ") |
| 69 | } |
| 70 | ctx.FormatNode(&node.Name) |
| 71 | if node.Owner != "" { |
| 72 | ctx.WriteString(" OWNER = ") |
| 73 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Owner, ctx.flags.EncodeFlags()) |
| 74 | } |
| 75 | if node.Template != "" { |
| 76 | ctx.WriteString(" TEMPLATE = ") |
| 77 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Template, ctx.flags.EncodeFlags()) |
| 78 | } |
| 79 | if node.Encoding != "" { |
| 80 | ctx.WriteString(" ENCODING = ") |
| 81 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Encoding, ctx.flags.EncodeFlags()) |
| 82 | } |
| 83 | if node.Strategy != "" { |
| 84 | ctx.WriteString(" STRATEGY = ") |
| 85 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Strategy, ctx.flags.EncodeFlags()) |
| 86 | } |
| 87 | if node.Locale != "" { |
| 88 | ctx.WriteString(" LOCALE = ") |
| 89 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Locale, ctx.flags.EncodeFlags()) |
| 90 | } |
| 91 | if node.Collate != "" { |
| 92 | ctx.WriteString(" LC_COLLATE = ") |
| 93 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Collate, ctx.flags.EncodeFlags()) |
| 94 | } |
| 95 | if node.CType != "" { |
| 96 | ctx.WriteString(" LC_CTYPE = ") |
| 97 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.CType, ctx.flags.EncodeFlags()) |
| 98 | } |
| 99 | if node.IcuLocale != "" { |
| 100 | ctx.WriteString(" ICU_LOCALE = ") |
| 101 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.IcuLocale, ctx.flags.EncodeFlags()) |
| 102 | } |
| 103 | if node.IcuRules != "" { |
| 104 | ctx.WriteString(" ICU_RULES = ") |
| 105 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.IcuRules, ctx.flags.EncodeFlags()) |
| 106 | } |
| 107 | if node.LocaleProvider != "" { |
| 108 | ctx.WriteString(" LOCALE_PROVIDER = ") |
| 109 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.LocaleProvider, ctx.flags.EncodeFlags()) |
| 110 | } |
| 111 | if node.CollationVersion != "" { |
| 112 | ctx.WriteString(" COLLATION_VERSION = ") |
| 113 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.CollationVersion, ctx.flags.EncodeFlags()) |
| 114 | } |
| 115 | if node.Tablespace != "" { |
| 116 | ctx.WriteString(" TABLESPACE = ") |
| 117 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.Tablespace, ctx.flags.EncodeFlags()) |
| 118 | } |
| 119 | if node.AllowConnections != nil { |
| 120 | ctx.WriteString(" ALLOW_CONNECTIONS = ") |
| 121 | lex.EncodeSQLStringWithFlags(&ctx.Buffer, node.AllowConnections.String(), ctx.flags.EncodeFlags()) |
| 122 | } |
nothing calls this directly
no test coverage detected