formatStatement formats individual SQL statements
(stmt ast.Statement)
| 80 | |
| 81 | // formatStatement formats individual SQL statements |
| 82 | func (f *SQLFormatter) formatStatement(stmt ast.Statement) error { |
| 83 | switch s := stmt.(type) { |
| 84 | case *ast.SelectStatement: |
| 85 | return f.formatSelect(s) |
| 86 | case *ast.InsertStatement: |
| 87 | return f.formatInsert(s) |
| 88 | case *ast.UpdateStatement: |
| 89 | return f.formatUpdate(s) |
| 90 | case *ast.DeleteStatement: |
| 91 | return f.formatDelete(s) |
| 92 | case *ast.CreateTableStatement: |
| 93 | return f.formatCreateTable(s) |
| 94 | case *ast.CreateIndexStatement: |
| 95 | return f.formatCreateIndex(s) |
| 96 | case *ast.AlterTableStatement: //nolint:staticcheck // AlterTableStatement kept for backward compatibility |
| 97 | return f.formatAlterTable(s) |
| 98 | case *ast.AlterStatement: |
| 99 | return f.formatAlterStatement(s) |
| 100 | case *ast.DropStatement: |
| 101 | return f.formatDrop(s) |
| 102 | case *ast.CreateViewStatement: |
| 103 | return f.formatCreateView(s) |
| 104 | case *ast.CreateMaterializedViewStatement: |
| 105 | return f.formatCreateMaterializedView(s) |
| 106 | case *ast.RefreshMaterializedViewStatement: |
| 107 | return f.formatRefreshMaterializedView(s) |
| 108 | case *ast.SetOperation: |
| 109 | return f.formatSetOperation(s) |
| 110 | case *ast.MergeStatement: |
| 111 | return f.formatMergeStatement(s) |
| 112 | default: |
| 113 | return fmt.Errorf("unsupported statement type: %T", stmt) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | // formatSelect formats SELECT statements with proper indentation and alignment |
| 118 | func (f *SQLFormatter) formatSelect(stmt *ast.SelectStatement) error { |
no test coverage detected