MCPcopy
hub / github.com/unkeyed/unkey / DBTX

Interface DBTX

pkg/mysql/interface.go:32–37  ·  view source on GitHub ↗

DBTX is an interface that abstracts database operations for both direct connections and transactions. It allows query methods to work with either a database or transaction, making transaction handling more flexible. This interface is implemented by both sql.DB and sql.Tx, as well as the custom Repl

Source from the content-addressed store, hash-verified

30// This interface is implemented by both sql.DB and sql.Tx, as well as
31// the custom Replica type in this package.
32type DBTX interface {
33 ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
34 PrepareContext(context.Context, string) (*sql.Stmt, error)
35 QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
36 QueryRowContext(context.Context, string, ...interface{}) *sql.Row
37}
38
39// DBTx represents a database transaction with commit and rollback capabilities.
40// It extends DBTX with transaction-specific methods.

Callers

nothing calls this directly

Implementers 4

TracedTxpkg/mysql/traced_tx.go
Replicapkg/mysql/replica.go
TracedTxpkg/db/traced_tx.go
Replicapkg/db/replica.go

Calls

no outgoing calls

Tested by

no test coverage detected