From dd794078c913f003e171c9d7c1d406c3067aae3f Mon Sep 17 00:00:00 2001 From: Himanshu Rai Date: Tue, 6 Aug 2024 12:08:12 +0530 Subject: [PATCH] Avoid savepoints when calling RunInTx from TxContext --- hyperbun.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/hyperbun.go b/hyperbun.go index cc0aecb..fd673db 100644 --- a/hyperbun.go +++ b/hyperbun.go @@ -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) {