Skip to content

Commit

Permalink
bbolt transaction scoper cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
UnAfraid committed Oct 22, 2023
1 parent 22535a4 commit 5f39b07
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func main() {
return
}

transactionScoper := dbx.NewBBoltTransactionScope(db)
transactionScoper := dbx.NewBBoltTransactionScoper(db)
subscriptionImpl := subscription.NewInMemorySubscription()

serverRepository := bbolt.NewServerRepository(db)
Expand Down
10 changes: 5 additions & 5 deletions pkg/dbx/bbolt_transaction_scoper.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ type contextKey struct{ name string }

var bboltTxKey = contextKey{name: "bboltTxKey"}

type bboltTransactionScope struct {
type bboltTransactionScoper struct {
db *bbolt.DB
}

func NewBBoltTransactionScope(db *bbolt.DB) TransactionScoper {
return &bboltTransactionScope{
func NewBBoltTransactionScoper(db *bbolt.DB) TransactionScoper {
return &bboltTransactionScoper{
db: db,
}
}

func (txScope *bboltTransactionScope) InTransactionScope(ctx context.Context, transactionScope func(ctx context.Context) error) (err error) {
return InBBoltTransactionScope(ctx, txScope.db, func(ctx context.Context, tx *bbolt.Tx) error {
func (bts *bboltTransactionScoper) InTransactionScope(ctx context.Context, transactionScope func(ctx context.Context) error) (err error) {
return InBBoltTransactionScope(ctx, bts.db, func(ctx context.Context, tx *bbolt.Tx) error {
return transactionScope(ctx)
})
}
Expand Down

0 comments on commit 5f39b07

Please sign in to comment.