1.2.0 • Published 6 months ago

db-lock v1.2.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

db-lock

Simple concurrent lock for DB patterns

npm install db-lock

Usage

const DBLock = require('db-lock')

const l = new DBLock({
  async enter () {
    return db.transaction()
  },
  async exit (tx) {
    await tx.flush()
  }
})

const tx = await l.enter() // opens the tx on first enter
// ... do stuff
await l.exit() // flushes the tx on last exit

License

Apache-2.0

1.2.0

6 months ago

1.1.1

7 months ago

1.1.0

7 months ago

1.1.3

7 months ago

1.1.2

7 months ago

1.0.0

7 months ago