1.0.4 • Published 2 years ago

bookshelf-column-cache v1.0.4

Weekly downloads
6
License
MIT
Repository
github
Last release
2 years ago

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