19 lines
690 B
Go
19 lines
690 B
Go
|
|
package sqlite
|
||
|
|
|
||
|
|
import (
|
||
|
|
"context"
|
||
|
|
"database/sql"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Executor is the shared query interface for both the connection pool and
|
||
|
|
// an active transaction. Repository code accepts Executor so it works
|
||
|
|
// identically inside and outside a [UnitOfWork].
|
||
|
|
type Executor interface {
|
||
|
|
// ExecContext executes a query that returns no rows.
|
||
|
|
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
|
||
|
|
// QueryContext executes a query that returns rows.
|
||
|
|
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
|
||
|
|
// QueryRowContext executes a query that returns at most one row.
|
||
|
|
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
|
||
|
|
}
|