summaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/jackc/pgx/v5/pgxpool/tx.go')
-rw-r--r--vendor/github.com/jackc/pgx/v5/pgxpool/tx.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go b/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go
index 74df8593a..b49e7f4d9 100644
--- a/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go
+++ b/vendor/github.com/jackc/pgx/v5/pgxpool/tx.go
@@ -18,9 +18,10 @@ func (tx *Tx) Begin(ctx context.Context) (pgx.Tx, error) {
return tx.t.Begin(ctx)
}
-// Commit commits the transaction and returns the associated connection back to the Pool. Commit will return ErrTxClosed
-// if the Tx is already closed, but is otherwise safe to call multiple times. If the commit fails with a rollback status
-// (e.g. the transaction was already in a broken state) then ErrTxCommitRollback will be returned.
+// Commit commits the transaction and returns the associated connection back to the Pool. Commit will return an error
+// where errors.Is(ErrTxClosed) is true if the Tx is already closed, but is otherwise safe to call multiple times. If
+// the commit fails with a rollback status (e.g. the transaction was already in a broken state) then ErrTxCommitRollback
+// will be returned.
func (tx *Tx) Commit(ctx context.Context) error {
err := tx.t.Commit(ctx)
if tx.c != nil {
@@ -30,9 +31,9 @@ func (tx *Tx) Commit(ctx context.Context) error {
return err
}
-// Rollback rolls back the transaction and returns the associated connection back to the Pool. Rollback will return ErrTxClosed
-// if the Tx is already closed, but is otherwise safe to call multiple times. Hence, defer tx.Rollback() is safe even if
-// tx.Commit() will be called first in a non-error condition.
+// Rollback rolls back the transaction and returns the associated connection back to the Pool. Rollback will return
+// where an error where errors.Is(ErrTxClosed) is true if the Tx is already closed, but is otherwise safe to call
+// multiple times. Hence, defer tx.Rollback() is safe even if tx.Commit() will be called first in a non-error condition.
func (tx *Tx) Rollback(ctx context.Context) error {
err := tx.t.Rollback(ctx)
if tx.c != nil {