File tree 1 file changed +7
-6
lines changed
1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -18,9 +18,10 @@ func (tx *Tx) Begin(ctx context.Context) (pgx.Tx, error) {
18
18
return tx .t .Begin (ctx )
19
19
}
20
20
21
- // Commit commits the transaction and returns the associated connection back to the Pool. Commit will return ErrTxClosed
22
- // if the Tx is already closed, but is otherwise safe to call multiple times. If the commit fails with a rollback status
23
- // (e.g. the transaction was already in a broken state) then ErrTxCommitRollback will be returned.
21
+ // Commit commits the transaction and returns the associated connection back to the Pool. Commit will return an error
22
+ // where errors.Is(ErrTxClosed) is true if the Tx is already closed, but is otherwise safe to call multiple times. If
23
+ // the commit fails with a rollback status (e.g. the transaction was already in a broken state) then ErrTxCommitRollback
24
+ // will be returned.
24
25
func (tx * Tx ) Commit (ctx context.Context ) error {
25
26
err := tx .t .Commit (ctx )
26
27
if tx .c != nil {
@@ -30,9 +31,9 @@ func (tx *Tx) Commit(ctx context.Context) error {
30
31
return err
31
32
}
32
33
33
- // Rollback rolls back the transaction and returns the associated connection back to the Pool. Rollback will return ErrTxClosed
34
- // if the Tx is already closed, but is otherwise safe to call multiple times. Hence, defer tx.Rollback() is safe even if
35
- // tx.Commit() will be called first in a non-error condition.
34
+ // Rollback rolls back the transaction and returns the associated connection back to the Pool. Rollback will return
35
+ // where an error where errors.Is(ErrTxClosed) is true if the Tx is already closed, but is otherwise safe to call
36
+ // multiple times. Hence, defer tx.Rollback() is safe even if tx.Commit() will be called first in a non-error condition.
36
37
func (tx * Tx ) Rollback (ctx context.Context ) error {
37
38
err := tx .t .Rollback (ctx )
38
39
if tx .c != nil {
You can’t perform that action at this time.
0 commit comments