FormatExpression renders an AST expression with the given options. Returns "" for nil.
(e ast.Expression, opts ast.FormatOptions)
| 173 | // FormatExpression renders an AST expression with the given options. |
| 174 | // Returns "" for nil. |
| 175 | func FormatExpression(e ast.Expression, opts ast.FormatOptions) string { |
| 176 | if e == nil { |
| 177 | return "" |
| 178 | } |
| 179 | switch v := e.(type) { |
| 180 | case *ast.CaseExpression: |
| 181 | return renderCase(v, opts) |
| 182 | case *ast.BetweenExpression: |
| 183 | return renderBetween(v, opts) |
| 184 | case *ast.InExpression: |
| 185 | return renderIn(v, opts) |
| 186 | case *ast.ExistsExpression: |
| 187 | return renderExists(v, opts) |
| 188 | case *ast.SubqueryExpression: |
| 189 | return renderSubquery(v, opts) |
| 190 | default: |
| 191 | return exprSQL(e) |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | // ─── statement renderers ───────────────────────────────────────────────────── |
| 196 |