Skip to content

LuKks/bee-transaction

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bee-transaction

Automatic batch for Hyperbee

npm i bee-transaction

Usage

It creates a batch, locks, gives you a callback to use it, and flushes or closes if any error.

const beeTransaction = require('bee-transaction')

const db = new Hyperbee(...)

const id = await beeTransaction(db, async function (b) {
  const userId = 1

  await b.put('/users/' + userId, { email, password })
  await b.put('/index/email/' + email, userId)

  return userId
})

console.log(id) // => 1

License

MIT

About

Automatic batch for Hyperbee

Resources

License

Stars

Watchers

Forks

Packages

No packages published