Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bookshelf-cls-transaction

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bookshelf-cls-transaction

A bookshelf plugin that uses continuation-local-storage to store transactions into call stack context. So you don't need to pass transaction into every method, that must be under transaction. This plugin does this automatically.

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

bookshelf-cls-transaction

A bookshelf plugin that uses continuation-local-storage to store transactions into call stack context. So you don't need to pass transaction into every method, that must be under transaction. This plugin does this automatically.

Examples

Without this plugin:

const user = await bookshelf.transaction(async (trx) => {
  const club = await new Club({ name: 'The Foos' })
    .save(null, { transacting: trx });
  const user = await new User({ name: 'Sam', club_id: club.id })
    .save(null, { transacting: trx });
  return user;
});

With this plugin:

const user = await bookshelf.transaction(async () => {
  const club = await new Club({ name: 'The Foos' }).save();
  const user = await new User({ name: 'Sam', club_id: club.id }).save();
  return user;
});

Installation

Install with npm:

npm i bookshelf-cls-transaction

Add plugin to your bookshelf:

bookshelf.plugin(require('bookshelf-cls-transaction'));

Keywords

FAQs

Package last updated on 12 Oct 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc