MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / Visit

Method Visit

cmd/gosqlx/cmd/sql_analyzer.go:116–153  ·  view source on GitHub ↗

Visit implements ast.Visitor interface for AST traversal

(node ast.Node)

Source from the content-addressed store, hash-verified

114
115// Visit implements ast.Visitor interface for AST traversal
116func (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
156func (a *SQLAnalyzer) analyzeSelectStatement(stmt *ast.SelectStatement) {

Callers

nothing calls this directly

Calls 9

analyzeJoinClauseMethod · 0.95
analyzeFunctionCallMethod · 0.95
analyzeIdentifierMethod · 0.95
analyzeLiteralValueMethod · 0.95

Tested by

no test coverage detected