{
"repo": "db-lock",
"timestamp": "2026-01-16T23:56:09.164Z",
"entryPoint": "index.js",
"exports": {
"packageJson": {
"main": "index.js"
}
},
"api": {
"file": "index.js",
"exports": [
{
"type": "default",
"name": "class"
}
],
"classes": [
{
"name": "DBLock"
}
],
"functions": []
},
"readme": {
"content": "# db-lock\n\nSimple concurrent lock for DB patterns\n\n```\nnpm install db-lock\n```\n\n## Usage\n\n```js\nconst DBLock = require('db-lock')\n\nconst l = new DBLock({\n async enter() {\n return db.transaction()\n },\n async exit(tx) {\n await tx.flush()\n }\n})\n\nconst tx = await l.enter() // opens the tx on first enter\n// ... do stuff\nawait l.exit() // flushes the tx on last exit\n```\n\n## License\n\nApache-2.0\n",
"sections": [
"intro",
"usage",
"license"
],
"hasApi": true,
"hasExamples": true,
"exampleCount": 2,
"examples": [
"npm install db-lock",
"const DBLock = require('db-lock')\n\nconst l = new DBLock({\n async enter() {\n return db.transaction()\n },\n async exit(tx) {\n await tx.flush()\n }\n})\n\nconst tx = await l.enter() // opens the tx on first enter\n// ... do stuff\nawait l.exit() // flushes the tx on last exit"
]
},
"patterns": []
}