You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
query:="SELECT * FROM users"// want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
12
+
13
+
vardb*sql.DB
14
+
rows,_:=db.Query("SELECT * FROM orders WHERE status = ?","active")// want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
15
+
_=rows
16
+
17
+
count:="SELECT COUNT(*) FROM users"
18
+
_=count
19
+
20
+
goodQuery:="SELECT id, name, email FROM users"
21
+
_=goodQuery
22
+
23
+
fmt.Println(query)
24
+
25
+
_=strconv.Itoa(42)
26
+
}
27
+
28
+
typeSQLBuilderinterface {
29
+
Select(columns...string)SQLBuilder
30
+
From(tablestring)SQLBuilder
31
+
Where(conditionstring)SQLBuilder
32
+
Query()string
33
+
}
34
+
35
+
func_(builderSQLBuilder) {
36
+
query:=builder.Select("*").From("products")// want "avoid SELECT \\* in SQL builder - explicitly specify columns to prevent unnecessary data transfer and schema change issues"
query:="SELECT * FROM users"// want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
13
+
14
+
vardb*sql.DB
15
+
rows,_:=db.Query("SELECT * FROM orders WHERE status = ?","active")// want "avoid SELECT \\* - explicitly specify needed columns for better performance, maintainability and stability"
16
+
_=rows
17
+
18
+
count:="SELECT COUNT(*) FROM users"
19
+
_=count
20
+
21
+
goodQuery:="SELECT id, name, email FROM users"
22
+
_=goodQuery
23
+
24
+
fmt.Println(query)
25
+
26
+
_=strconv.Itoa(42)
27
+
}
28
+
29
+
// Custom allowed patterns test - SELECT * from temp tables should be allowed