Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 61 | |
| 62 | // Format implements the NodeFormatter interface. |
| 63 | func (node *AlterDatabase) Format(ctx *FmtCtx) { |
| 64 | ctx.WriteString("ALTER DATABASE ") |
| 65 | ctx.FormatNode(&node.Name) |
| 66 | if len(node.Options) > 0 { |
| 67 | opts := make([]string, len(node.Options)) |
| 68 | for i, opt := range node.Options { |
| 69 | opts[i] = fmt.Sprintf("%s %s", opt.Opt, AsString(opt.Val)) |
| 70 | } |
| 71 | ctx.WriteString(fmt.Sprintf(" WITH %s", strings.Join(opts, " "))) |
| 72 | } else if node.Owner != "" { |
| 73 | ctx.WriteString(" OWNER TO ") |
| 74 | ctx.FormatNameP(&node.Owner) |
| 75 | } else if node.Tablespace != "" { |
| 76 | ctx.WriteString(" SET TABLESPACE ") |
| 77 | ctx.FormatNameP(&node.Tablespace) |
| 78 | } else if node.RefreshCollationVersion { |
| 79 | ctx.WriteString(" REFRESH COLLATION VERSION") |
| 80 | } else if node.SetVar != nil { |
| 81 | ctx.WriteByte(' ') |
| 82 | node.SetVar.Format(ctx) |
| 83 | } else if node.ResetVar != "" { |
| 84 | ctx.WriteString(" RESET ") |
| 85 | ctx.FormatNameP(&node.ResetVar) |
| 86 | } else if node.ResetAll { |
| 87 | ctx.WriteString(" RESET ALL") |
| 88 | } |
| 89 | } |
nothing calls this directly
no test coverage detected