MCPcopy
hub / github.com/jmoiron/sqlx / BeginTxx

Method BeginTxx

sqlx_context.go:204–210  ·  view source on GitHub ↗

BeginTxx begins a transaction and returns an *sqlx.Tx instead of an *sql.Tx. The provided context is used until the transaction is committed or rolled back. If the context is canceled, the sql package will roll back the transaction. Tx.Commit will return an error if the context provided to BeginxCo

(ctx context.Context, opts *sql.TxOptions)

Source from the content-addressed store, hash-verified

202// transaction. Tx.Commit will return an error if the context provided to
203// BeginxContext is canceled.
204func (db *DB) BeginTxx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) {
205 tx, err := db.DB.BeginTx(ctx, opts)
206 if err != nil {
207 return nil, err
208 }
209 return &Tx{Tx: tx, driverName: db.driverName, unsafe: db.unsafe, Mapper: db.Mapper}, err
210}
211
212// Connx returns an *sqlx.Conn instead of an *sql.Conn.
213func (db *DB) Connx(ctx context.Context) (*Conn, error) {

Callers 2

MustBeginTxMethod · 0.95
TestConnFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestConnFunction · 0.36