diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-05-12 13:11:41 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-05-12 13:11:41 +0200 |
| commit | 7bdc14a145c4b5c380921abf1db3f2c00a9c66cc (patch) | |
| tree | d08f4436739456ab015598eb9f02047208f981de /oblast.go | |
| parent | d5e652b41e68538fc7a7d8f67c3b8dfe3129a464 (diff) | |
| download | go-oblast-7bdc14a145c4b5c380921abf1db3f2c00a9c66cc.tar.gz | |
change Handle to a generic interface without explicit dep on database/sql
Diffstat (limited to 'oblast.go')
| -rw-r--r-- | oblast.go | 20 |
1 files changed, 0 insertions, 20 deletions
@@ -96,7 +96,6 @@ package oblast // import "go.xyrillian.de/oblast" import ( - "context" "database/sql" "database/sql/driver" "fmt" @@ -132,25 +131,6 @@ func StructTagKeyIs(key string) PlanOption { return func(opts *planOpts) { opts.StructTagKey = key } } -// Handle is an interface for functions providing direct DB access. -// It covers methods provided by both *sql.DB and *sql.Tx, thus allowing functions using it to be used both within and outside of transactions. -type Handle interface { - ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error) - PrepareContext(ctx context.Context, query string) (*sql.Stmt, error) - QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error) - QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row -} - -// TODO: investigate if we can extend type Handle to cover types github.com/jackc/pgx.{Conn,Tx} -// - those have all these methods, but with different return types that act mostly in the same way -// - a significant departure is that their Prepare() works wildly differently - -// static assertion that the respective types implement the interface -var ( - _ Handle = &sql.DB{} - _ Handle = &sql.Tx{} -) - // Store is the main interface of this library. // // It holds information on how to read and write data into record type R, |
