Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 189 | |
| 190 | // Format implements the NodeFormatter interface. |
| 191 | func (n *TableIndexName) Format(ctx *FmtCtx) { |
| 192 | if n.Index == "" { |
| 193 | ctx.FormatNode(&n.Table) |
| 194 | return |
| 195 | } |
| 196 | |
| 197 | if n.Table.ObjectName != "" { |
| 198 | // The table is specified. |
| 199 | ctx.FormatNode(&n.Table) |
| 200 | ctx.WriteByte('@') |
| 201 | ctx.FormatNode(&n.Index) |
| 202 | return |
| 203 | } |
| 204 | |
| 205 | // The table is not specified. The schema/catalog can still be specified. |
| 206 | if n.Table.ExplicitSchema || ctx.alwaysFormatTablePrefix() { |
| 207 | ctx.FormatNode(&n.Table.ObjectNamePrefix) |
| 208 | ctx.WriteByte('.') |
| 209 | } |
| 210 | // In this case, we must format the index name as a restricted name (quotes |
| 211 | // must be added for reserved keywords). |
| 212 | ctx.FormatNode((*Name)(&n.Index)) |
| 213 | } |
| 214 | |
| 215 | func (n *TableIndexName) String() string { return AsString(n) } |
| 216 |
nothing calls this directly
no test coverage detected