Skip to content

Commit

Permalink
Wrap pgx.Tx.Rollback in a database.SyncTx (#101)
Browse files Browse the repository at this point in the history
* Wrap pgx.Tx.Rollback in a database.SyncTx

* Fix issue with this change
  • Loading branch information
XDoubleU authored Jan 5, 2025
1 parent 79de924 commit 25dc759
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/database/postgres/pgx_sync_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,13 @@ func (tx *PgxSyncTx) Begin(ctx context.Context) (pgx.Tx, error) {
)
}

// Rollback is used to rollback a [PgxSyncTx].
// Rollback is used to wrap [pgx.Tx.Rollback] in a [database.SyncTx].
func (tx *PgxSyncTx) Rollback(ctx context.Context) error {
return tx.syncTx.Rollback(ctx)
return database.WrapInSyncTxNoError(
ctx,
tx.syncTx,
func(ctx context.Context) error {
return tx.syncTx.Tx.Rollback(ctx)
},
)
}

0 comments on commit 25dc759

Please sign in to comment.