aboutsummaryrefslogtreecommitdiff
path: root/handle
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-05-13 01:11:30 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-05-13 01:13:17 +0200
commita561ebb42148c72638f943e44191da07c16df7f6 (patch)
treefb2ecc409fa3c0d39ac8408da95820db8ebebed0 /handle
parent2fe6a5a42ccb663211f4f4804b78fff3bd9ebdc0 (diff)
downloadgo-oblast-a561ebb42148c72638f943e44191da07c16df7f6.tar.gz
return a concrete type from Wrap() to enable non-Oblast DB operations
Diffstat (limited to 'handle')
-rw-r--r--handle/handle.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/handle/handle.go b/handle/handle.go
index eaf3558..4af712a 100644
--- a/handle/handle.go
+++ b/handle/handle.go
@@ -13,16 +13,18 @@ import (
// Handle contains behavior that database handles must offer to Oblast.
// The standard-library types [*sql.DB] and [*sql.Tx] can satisfy this interface through the Wrap() function from the main package.
// Custom implementations of this interface can be used to connect non-std database drivers to Oblast.
+//
+// The method names are deliberately clunky to avoid name clashes with well-known methods like [sql.DB.Prepare] or [sql.DB.Query].
type Handle interface {
- // Prepare prepares to execute a certain SQL query one or multiple times.
+ // OblastPrepare prepares to execute a certain SQL query one or multiple times.
//
// The "repeated" flag is a hint to the implementation whether the same statement is going to be run many times.
// If false, the implementation shall choose to forego the additional effort of a full statement preparation if possible,
// and execute one-off queries instead.
- Prepare(ctx context.Context, query string, repeated bool) (Statement, error)
+ OblastPrepare(ctx context.Context, query string, repeated bool) (Statement, error)
- // Query works like db.QueryContext(ctx, query, args...).
- Query(ctx context.Context, query string, args []any) (Rows, error)
+ // OblastQuery works like db.QueryContext(ctx, query, args...).
+ OblastQuery(ctx context.Context, query string, args []any) (Rows, error)
}
// Statement represents a prepared statement returned from [Handle.Prepare].