Format implements the NodeFormatter interface.
(ctx *FmtCtx)
| 175 | |
| 176 | // Format implements the NodeFormatter interface. |
| 177 | func (node RoutineOption) Format(ctx *FmtCtx) { |
| 178 | switch node.OptionType { |
| 179 | case OptionLanguage: |
| 180 | ctx.WriteString("LANGUAGE ") |
| 181 | ctx.WriteString(node.Language) |
| 182 | case OptionTransform: |
| 183 | ctx.WriteString("TRANSFORM ") |
| 184 | for i, t := range node.TransformTypes { |
| 185 | if i != 0 { |
| 186 | ctx.WriteString(", ") |
| 187 | } |
| 188 | ctx.WriteString("FOR TYPE ") |
| 189 | ctx.WriteString(t.SQLString()) |
| 190 | } |
| 191 | case OptionWindow: |
| 192 | ctx.WriteString("WINDOW") |
| 193 | case OptionVolatility: |
| 194 | switch node.Volatility { |
| 195 | case VolatilityImmutable: |
| 196 | ctx.WriteString("IMMUTABLE") |
| 197 | case VolatilityStable: |
| 198 | ctx.WriteString("STABLE") |
| 199 | case VolatilityVolatile: |
| 200 | ctx.WriteString("VOLATILE") |
| 201 | default: |
| 202 | } |
| 203 | case OptionLeakProof: |
| 204 | if !node.IsLeakProof { |
| 205 | ctx.WriteString("NOT ") |
| 206 | } |
| 207 | ctx.WriteString("LEAKPROOF") |
| 208 | case OptionNullInput: |
| 209 | ctx.WriteString(strings.ToUpper(string(node.NullInput))) |
| 210 | case OptionSecurity: |
| 211 | if node.External { |
| 212 | ctx.WriteString("EXTERNAL ") |
| 213 | } |
| 214 | ctx.WriteString("SECURITY ") |
| 215 | if node.Definer { |
| 216 | ctx.WriteString("DEFINER") |
| 217 | } else { |
| 218 | ctx.WriteString("INVOKER") |
| 219 | } |
| 220 | case OptionParallel: |
| 221 | ctx.WriteString("PARALLEL") |
| 222 | ctx.WriteString(strings.ToUpper(string(node.Parallel))) |
| 223 | case OptionCost: |
| 224 | ctx.WriteString("COST ") |
| 225 | ctx.FormatNode(node.Cost) |
| 226 | case OptionRows: |
| 227 | ctx.WriteString("ROWS ") |
| 228 | ctx.FormatNode(node.Rows) |
| 229 | case OptionSupport: |
| 230 | ctx.WriteString("SUPPORT ") |
| 231 | ctx.WriteString(node.Support) |
| 232 | case OptionSet: |
| 233 | ctx.WriteString("SET ") |
| 234 | ctx.FormatNode(node.SetVar) |
nothing calls this directly
no test coverage detected