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
| 30 | // This interface is implemented by both sql.DB and sql.Tx, as well as |
| 31 | // the custom Replica type in this package. |
| 32 | type 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. |