bookshelf-repl

0.0.4 • Public • Published

bookshelf-repl

A REPL for your Bookshelf.js projects

Notes

Currently only works with MySQL.

Example

Your code

var
  dbRepl = require('bookshelf-repl'),
  knex = require('knex').initialize(getKnexConfig()),
  options = {
    prompt: 'DB> '
  };
 
dbRepl
  .start(knex, options)
  .then(function(repl) {
    repl.on('exit', function onReplExit() {
      console.log('Got "exit" event from repl!');
      process.exit();
    });
  })
  .catch(console.error);
 
function getKnexConfig() {
  // get your knex configuration from somewhere
  return {};
}

The repl

Globals

A few globals are created when the repl starts:

  • ld - lodash
  • knex - The knex instance used to initialize the REPL
  • bookshelf - A bookshelf instance created using the given knex instance
  • db - An object with some metadata about the current database connection

Readme

Keywords

Package Sidebar

Install

npm i bookshelf-repl

Weekly Downloads

2

Version

0.0.4

License

MIT

Last publish

Collaborators

  • chrisbroome