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

Function analyzeWithRule

pkg/advisor/advisor_advanced_test.go:26–36  ·  view source on GitHub ↗

analyzeWithRule parses sql and runs a single Rule against the first statement.

(t *testing.T, sql string, rule Rule)

Source from the content-addressed store, hash-verified

24
25// analyzeWithRule parses sql and runs a single Rule against the first statement.
26func analyzeWithRule(t *testing.T, sql string, rule Rule) []Suggestion {
27 t.Helper()
28 tree, err := gosqlx.Parse(sql)
29 if err != nil {
30 t.Fatalf("Parse(%q): %v", sql, err)
31 }
32 if len(tree.Statements) == 0 {
33 t.Fatal("no statements parsed")
34 }
35 return rule.Analyze(tree.Statements[0])
36}
37
38// ---------------------------------------------------------------------------
39// OPT-009: Correlated Subquery in SELECT List

Calls 4

ParseFunction · 0.92
HelperMethod · 0.65
FatalfMethod · 0.65
AnalyzeMethod · 0.65

Tested by

no test coverage detected