diff options
| author | Stefan Majewsky <majewsky@gmx.net> | 2026-05-13 01:11:30 +0200 |
|---|---|---|
| committer | Stefan Majewsky <majewsky@gmx.net> | 2026-05-13 01:13:17 +0200 |
| commit | a561ebb42148c72638f943e44191da07c16df7f6 (patch) | |
| tree | fb2ecc409fa3c0d39ac8408da95820db8ebebed0 /handle/handle.go | |
| parent | 2fe6a5a42ccb663211f4f4804b78fff3bd9ebdc0 (diff) | |
| download | go-oblast-a561ebb42148c72638f943e44191da07c16df7f6.tar.gz | |
return a concrete type from Wrap() to enable non-Oblast DB operations
Diffstat (limited to 'handle/handle.go')
| -rw-r--r-- | handle/handle.go | 10 |
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]. |
