From a561ebb42148c72638f943e44191da07c16df7f6 Mon Sep 17 00:00:00 2001 From: Stefan Majewsky Date: Wed, 13 May 2026 01:11:30 +0200 Subject: return a concrete type from Wrap() to enable non-Oblast DB operations --- handle/handle.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'handle/handle.go') 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]. -- cgit v1.2.3