bookshelf-column-cache

1.0.4 • Public • Published

Bookshelf Column Cache

This plugin works with Bookshelf.js. Add a utility function to the Bookshelf object that can be accessed by other plugins or yourself.

It does this by checking the database for all the valid column names for a given table and caching the values

Installation

npm install bookshelf-column-cache

Then in your bookshelf configuration:

const bookshelf = require('bookshelf')(knex);
bookshelf.plugin(require('bookshelf-column-cache');

bookshelf.plugin(require('some-other-plugin-that-uses-column-cache'))

Usage

let columnSet = await bookshelf.ColumnCache.getColumnsForTable("users");
//columnsSet will be a Set of the column names on the users table

Package Sidebar

Install

npm i bookshelf-column-cache

Weekly Downloads

1

Version

1.0.4

License

MIT

Unpacked Size

6.67 kB

Total Files

11

Last publish

Collaborators

  • 1mike12