How to use the knex.knex function in knex

To help you get started, we’ve selected a few knex examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bulkan / pggy / index.js View on Github external
screen.append(searchBox);
screen.append(tableInfo);

// Quit on Escape, q, or Control-C.
screen.key(['C-q'], function(ch, key) {
  return process.exit(0);
});


screen.key(['r', 'C-r'], function(ch, key) {
  rawQuery.focus();
});

// store list of tables
var tables = [],
    knex = Knex.knex;  //refence to knex instance



// load the table
tablesList.on('select', function(event, selectedIndex){
  var tableName = tables[selectedIndex];
  log.debug('selected table:', tableName);

  knex(tableName)
    .select()
    .then(function(rows){
      if (rows.length === 0) {
        return;
      }
      var columns = _.keys(rows[0]);
github bulkan / pggy / index.js View on Github external
, getTableInfo = require('./lib/tableInfo')
  , getTablesList = require('./lib/tablesList')
  , getDropMenu = require('./lib/dropMenu')
  , utils;

var log = bunyan.createLogger({
  name: 'pggy',
  streams: [
    {
      'level': 'debug',
      'path': 'pggy.log'
    }
  ]
})

Knex.knex = Knex.initialize({
  client: 'pg',
  connection: {
    host     : conf.hostname,
    user     : conf.username,
    password : conf.password,
    database : conf.database,
  }
});

utils = require('./lib/utils')(Knex.knex, log);


// Create a screen object.
var screen = blessed.screen();

var searchBox = blessed.textbox({