-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for sqlx NamedStmt (#26)
- Loading branch information
Showing
9 changed files
with
46 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# github.com/ryanrolds/sqlclosecheck/testdata/pgx_examples | ||
testdata/pgx_examples/missing_close.go:8:26: Rows/Stmt was not closed | ||
testdata/pgx_examples/missing_close.go:17:28: Rows/Stmt was not closed | ||
testdata/pgx_examples/missing_close.go:26:28: Rows/Stmt was not closed | ||
testdata/pgx_examples/missing_close.go:8:26: Rows/Stmt/NamedStmt was not closed | ||
testdata/pgx_examples/missing_close.go:17:28: Rows/Stmt/NamedStmt was not closed | ||
testdata/pgx_examples/missing_close.go:26:28: Rows/Stmt/NamedStmt was not closed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# github.com/ryanrolds/sqlclosecheck/testdata/pgx_examples | ||
testdata/pgx_examples/missing_close.go:8:26: Rows/Stmt was not closed | ||
testdata/pgx_examples/missing_close.go:17:28: Rows/Stmt was not closed | ||
testdata/pgx_examples/missing_close.go:26:28: Rows/Stmt was not closed | ||
testdata/pgx_examples/missing_close.go:8:26: Rows/Stmt/NamedStmt was not closed | ||
testdata/pgx_examples/missing_close.go:17:28: Rows/Stmt/NamedStmt was not closed | ||
testdata/pgx_examples/missing_close.go:26:28: Rows/Stmt/NamedStmt was not closed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# github.com/ryanrolds/sqlclosecheck/testdata/sqlx_examples | ||
testdata/sqlx_examples/failure_generics.go:6:21: Rows/Stmt was not closed | ||
testdata/sqlx_examples/failure_generics.go:13:21: Rows/Stmt was not closed | ||
testdata/sqlx_examples/missing_close.go:10:24: Rows/Stmt was not closed | ||
testdata/sqlx_examples/failure_generics.go:6:21: Rows/Stmt/NamedStmt was not closed | ||
testdata/sqlx_examples/failure_generics.go:13:21: Rows/Stmt/NamedStmt was not closed | ||
testdata/sqlx_examples/missing_close.go:10:24: Rows/Stmt/NamedStmt was not closed | ||
testdata/sqlx_examples/missing_close_named_stmt.go:8:30: Rows/Stmt/NamedStmt was not closed | ||
testdata/sqlx_examples/non_defer_close.go:30:12: Close should use defer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package sqlx_examples | ||
|
||
import ( | ||
"log" | ||
) | ||
|
||
func missingCloseNamedStmt() { | ||
stmt, err := db.PrepareNamed("SELECT * FROM users WHERE id = :id") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// defer stmt.Close() | ||
|
||
_ = stmt // No need to use stmt | ||
} |