lockgoose

0.3.1 • Public • Published

lockgoose

A simple library for creating locks with mongoose.

Install

npm i lockgoose

Requires mongoose ^5.0.0 to be installed as a dependency.

Usage

const lockgoose = require('lockgoose');
 
// (initialise your mongoose connection here)
 
// initialise lockgoose
await lockgoose.init({ /* options */ });
 
// create a lock
const lock = await lockgoose.lock('tag');
 
// unlock a lock in-scope
await lock.unlock();
 
// unlock a lock created earlier
await lockgoose.unlock('tag');
 
// reinit index on locks (useful if you are dropping database during testing)
await lockgoose.init();

Test

Testing provided by Jest and linting by eslint.

npm test
npm run test:lint

Readme

Keywords

Package Sidebar

Install

npm i lockgoose

Weekly Downloads

1

Version

0.3.1

License

MIT

Unpacked Size

10.4 kB

Total Files

9

Last publish

Collaborators

  • iain8