Socket
Book a DemoInstallSign in
Socket

db-lock

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

db-lock

Simple concurrent lock for DB patterns

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
0
Created
Source

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

FAQs

Package last updated on 12 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts