Skip to content

Commit

Permalink
feat: make the isolation level transaction configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad Luthfi Fahlevi committed Feb 7, 2025
1 parent f05f073 commit 357f88f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/store/postgres/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ type Client struct {
}

func (c *Client) RunWithinTx(ctx context.Context, f func(tx *sqlx.Tx) error) error {
tx, err := c.db.BeginTxx(ctx, nil)
return c.RunWithinTxWithOption(ctx, nil, f)
}

func (c *Client) RunWithinTxWithOption(ctx context.Context, opts *sql.TxOptions, f func(tx *sqlx.Tx) error) error {
tx, err := c.db.BeginTxx(ctx, opts)
if err != nil {
return fmt.Errorf("starting transaction: %w", err)
}
Expand Down

0 comments on commit 357f88f

Please sign in to comment.