Skip to content

Commit

Permalink
fix: Pass corresponding options to db.With... methods (#159)
Browse files Browse the repository at this point in the history
  • Loading branch information
akiozihao authored Apr 23, 2024
1 parent fec041b commit daa4431
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions db.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func (db *DB) Put(key []byte, value []byte) error {
// You can think the batch has only one Put operation.
func (db *DB) PutWithOptions(key []byte, value []byte, options WriteOptions) error {
batch := db.batchPool.Get().(*Batch)
batch.options.WriteOptions = options
defer func() {
batch.reset()
db.batchPool.Put(batch)
Expand Down Expand Up @@ -245,6 +246,7 @@ func (db *DB) Delete(key []byte) error {
// You can think the batch has only one Delete operation.
func (db *DB) DeleteWithOptions(key []byte, options WriteOptions) error {
batch := db.batchPool.Get().(*Batch)
batch.options.WriteOptions = options
defer func() {
batch.reset()
db.batchPool.Put(batch)
Expand Down

0 comments on commit daa4431

Please sign in to comment.