Visit implements ast.Visitor interface for AST traversal
(node ast.Node)
| 114 | |
| 115 | // Visit implements ast.Visitor interface for AST traversal |
| 116 | func (a *SQLAnalyzer) Visit(node ast.Node) (ast.Visitor, error) { |
| 117 | if node == nil { |
| 118 | // End of traversal for this branch |
| 119 | a.currentDepth-- |
| 120 | return nil, nil |
| 121 | } |
| 122 | |
| 123 | // Track nesting depth |
| 124 | a.currentDepth++ |
| 125 | if a.currentDepth > a.maxDepth { |
| 126 | a.maxDepth = a.currentDepth |
| 127 | } |
| 128 | |
| 129 | // Analyze specific node types |
| 130 | switch n := node.(type) { |
| 131 | case *ast.SelectStatement: |
| 132 | a.analyzeSelectStatement(n) |
| 133 | case *ast.InsertStatement: |
| 134 | a.analyzeInsertStatement(n) |
| 135 | case *ast.UpdateStatement: |
| 136 | a.analyzeUpdateStatement(n) |
| 137 | case *ast.DeleteStatement: |
| 138 | a.analyzeDeleteStatement(n) |
| 139 | case *ast.JoinClause: |
| 140 | a.analyzeJoinClause(n) |
| 141 | case *ast.BinaryExpression: |
| 142 | a.analyzeBinaryExpression(n) |
| 143 | case *ast.FunctionCall: |
| 144 | a.analyzeFunctionCall(n) |
| 145 | case *ast.Identifier: |
| 146 | a.analyzeIdentifier(n) |
| 147 | case *ast.LiteralValue: |
| 148 | a.analyzeLiteralValue(n) |
| 149 | } |
| 150 | |
| 151 | // Continue traversal |
| 152 | return a, nil |
| 153 | } |
| 154 | |
| 155 | // analyzeSelectStatement analyzes SELECT statements for issues |
| 156 | func (a *SQLAnalyzer) analyzeSelectStatement(stmt *ast.SelectStatement) { |
nothing calls this directly
no test coverage detected