aboutsummaryrefslogtreecommitdiff
path: root/query.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-04-12 16:45:59 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-04-12 16:45:59 +0200
commit8d60f626d819f8bdb038ce619d00946442cc2594 (patch)
tree672f828af4a7ad098d41f3f98f45efa45f4c3635 /query.go
parente9d31443f01eda2ecee66dbc25f154a6949a9c97 (diff)
downloadgo-oblast-8d60f626d819f8bdb038ce619d00946442cc2594.tar.gz
add Handle interface
Diffstat (limited to 'query.go')
-rw-r--r--query.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/query.go b/query.go
index e47feb6..fd80f56 100644
--- a/query.go
+++ b/query.go
@@ -11,8 +11,7 @@ import (
"go.xyrillian.de/oblast/internal"
)
-// TODO: allow taking *sql.Tx in addition to *sql.DB
-func (s Store[R]) Select(db *sql.DB, query string, args ...any) (result []R, returnedError error) {
+func (s Store[R]) Select(db Handle, query string, args ...any) (result []R, returnedError error) {
// NOTE: This function body should be as short as possible to reduce the binary size after monomorphization.
// Any expression that does not depend on type R should be factored out into a reusable function.
@@ -37,7 +36,7 @@ func (s Store[R]) Select(db *sql.DB, query string, args ...any) (result []R, ret
return result, nil
}
-func startQuery(db *sql.DB, plan internal.Plan, query string, args ...any) (rows *sql.Rows, indexes [][]int, err error) {
+func startQuery(db Handle, plan internal.Plan, query string, args ...any) (rows *sql.Rows, indexes [][]int, err error) {
rows, err = db.Query(query, args...)
if err != nil {
return nil, nil, fmt.Errorf("during Query(): %w", err)