fix: WithinTx now actually places the transaction into the context

This commit is contained in:
2026-09-09 16:30:43 +02:00
parent 366386c8bf
commit 4a967ef002
+2 -2
View File
@@ -49,9 +49,9 @@ func (t *Transactor) WithinTx(ctx context.Context, fn func(context.Context) erro
if err != nil { if err != nil {
return err return err
} }
defer tx.Rollback() defer func() { _ = tx.Rollback() }()
if err = fn(ctx); err != nil { if err = fn(context.WithValue(ctx, txKey{}, tx)); err != nil {
return err return err
} }
return tx.Commit() return tx.Commit()