Skip to content

Commit

Permalink
Avoid savepoints when calling RunInTx from TxContext
Browse files Browse the repository at this point in the history
  • Loading branch information
hi-rai committed Aug 6, 2024
1 parent f6d6d4e commit dd79407
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions hyperbun.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@ func (m TxContext) NewValues(model interface{}) *bun.ValuesQuery {
}

func (m TxContext) RunInTx(fn func(tx TxContext) error) error {
return m.Bun.RunInTx(m.ctx, &sql.TxOptions{}, func(ctx context.Context, tx bun.Tx) error {
return fn(NewTxContext(ctx, tx))
})
return fn(m)
}

func ByID[T any, ID string | int](m DB, id ID) (*T, error) {
Expand Down

0 comments on commit dd79407

Please sign in to comment.