Commit and Rollback take context
Remove Ex versions.
This commit is contained in:
+4
-4
@@ -12,8 +12,8 @@ type Tx struct {
|
||||
c *Conn
|
||||
}
|
||||
|
||||
func (tx *Tx) Commit() error {
|
||||
err := tx.t.Commit()
|
||||
func (tx *Tx) Commit(ctx context.Context) error {
|
||||
err := tx.t.Commit(ctx)
|
||||
if tx.c != nil {
|
||||
tx.c.Release()
|
||||
tx.c = nil
|
||||
@@ -21,8 +21,8 @@ func (tx *Tx) Commit() error {
|
||||
return err
|
||||
}
|
||||
|
||||
func (tx *Tx) Rollback() error {
|
||||
err := tx.t.Rollback()
|
||||
func (tx *Tx) Rollback(ctx context.Context) error {
|
||||
err := tx.t.Rollback(ctx)
|
||||
if tx.c != nil {
|
||||
tx.c.Release()
|
||||
tx.c = nil
|
||||
|
||||
+3
-3
@@ -16,7 +16,7 @@ func TestTxExec(t *testing.T) {
|
||||
|
||||
tx, err := pool.Begin()
|
||||
require.NoError(t, err)
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback(context.Background())
|
||||
|
||||
testExec(t, tx)
|
||||
}
|
||||
@@ -28,7 +28,7 @@ func TestTxQuery(t *testing.T) {
|
||||
|
||||
tx, err := pool.Begin()
|
||||
require.NoError(t, err)
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback(context.Background())
|
||||
|
||||
testQuery(t, tx)
|
||||
}
|
||||
@@ -40,7 +40,7 @@ func TestTxQueryRow(t *testing.T) {
|
||||
|
||||
tx, err := pool.Begin()
|
||||
require.NoError(t, err)
|
||||
defer tx.Rollback()
|
||||
defer tx.Rollback(context.Background())
|
||||
|
||||
testQueryRow(t, tx)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user