Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build knex object in constructor #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const bootstrapPlv8 = require('./lib/bootstrap')
const babel = require('babel-core')
const browserify = require('browserify')
const babelify = require('babelify')
const knex = require('knex');
const babelOptions = {
presets: [
require('babel-preset-es2015')
Expand Down Expand Up @@ -167,7 +168,7 @@ module.exports = class PLV8 {
})
}

constructor (knex) {
this.knex = knex
constructor (config) {
this.knex = knex(config)
}
}
7 changes: 4 additions & 3 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ const knex = require('knex')
const PLV8 = require('../')

describe('plv8', () => {
const knexHandle = knex({
const config= {
client: 'pg',
connection: {
host: process.env.PLV8_HOST,
user: process.env.PLV8_USER,
password: process.env.PLV8_PASSWORD,
database: process.env.PLV8_DATABASE
}
})
const plv8 = new PLV8(knexHandle)
};
const knexHandle = knex(config)
const plv8 = new PLV8(config)

describe('#install', () => {
it('should install a module', () => {
Expand Down