Comparing version 3.0.0 to 3.1.0
@@ -27,3 +27,3 @@ 'use strict'; | ||
this._settings = Hoek.clone(options); | ||
this._name = name; | ||
this.name = name; | ||
this._connection = null; | ||
@@ -132,7 +132,7 @@ | ||
if (names.indexOf(this._name) === -1) { | ||
if (names.indexOf(this.name) === -1) { | ||
// Create new database | ||
RethinkDB.dbCreate(this._name).run(this._connection, (err, created) => { | ||
RethinkDB.dbCreate(this.name).run(this._connection, (err, created) => { | ||
@@ -167,3 +167,3 @@ if (err) { | ||
RethinkDB.db(this._name).tableList().run(this._connection, (err, existing) => { | ||
RethinkDB.db(this.name).tableList().run(this._connection, (err, existing) => { | ||
@@ -199,3 +199,3 @@ if (err) { | ||
if (existing.indexOf(name) === -1) { | ||
return RethinkDB.db(this._name).tableCreate(name).run(this._connection, (err) => finalize(err, options.index)); | ||
return RethinkDB.db(this.name).tableCreate(name).run(this._connection, (err) => finalize(err, options.index)); | ||
} | ||
@@ -207,3 +207,3 @@ | ||
RethinkDB.db(this._name).table(name).indexList().run(this._connection, (err, currentIndexes) => { | ||
RethinkDB.db(this.name).table(name).indexList().run(this._connection, (err, currentIndexes) => { | ||
@@ -221,3 +221,3 @@ if (err) { | ||
RethinkDB.db(this._name).table(name).indexDrop(index).run(this._connection, nextIndex); | ||
RethinkDB.db(this.name).table(name).indexDrop(index).run(this._connection, nextIndex); | ||
}; | ||
@@ -224,0 +224,0 @@ |
@@ -22,6 +22,6 @@ 'use strict'; | ||
this._name = name; | ||
this.name = name; | ||
this._db = db; | ||
this._table = RethinkDB.db(this._db._name).table(name); | ||
this._table = RethinkDB.db(this._db.name).table(name); | ||
this._cursors = []; | ||
@@ -259,4 +259,4 @@ } | ||
return callback(Boom.internal('Database error', { error: err, table: this._name, action: action, inputs: inputs })); | ||
return callback(Boom.internal('Database error', { error: err, table: this.name, action: action, inputs: inputs })); | ||
} | ||
}; |
{ | ||
"name": "penseur", | ||
"description": "Lightweight RethinkDB wrapper", | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"author": "Eran Hammer <eran@hammer.io> (http://hueniverse.com)", | ||
@@ -6,0 +6,0 @@ "repository": "git://github.com/hueniverse/penseur", |
@@ -161,3 +161,3 @@ 'use strict'; | ||
RethinkDB.dbDrop(db._name).run(db._connection, (err, dropped) => { | ||
RethinkDB.dbDrop(db.name).run(db._connection, (err, dropped) => { | ||
@@ -169,3 +169,3 @@ expect(err).to.not.exist(); | ||
expect(err).to.not.exist(); | ||
RethinkDB.db(db._name).table('test').indexList().run(db._connection, (err, result) => { | ||
RethinkDB.db(db.name).table('test').indexList().run(db._connection, (err, result) => { | ||
@@ -229,3 +229,3 @@ expect(err).to.not.exist(); | ||
RethinkDB.db(db1._name).table('test').indexList().run(db1._connection, (err, result1) => { | ||
RethinkDB.db(db1.name).table('test').indexList().run(db1._connection, (err, result1) => { | ||
@@ -244,3 +244,3 @@ expect(err).to.not.exist(); | ||
expect(err).to.not.exist(); | ||
RethinkDB.db(db2._name).table('test').indexList().run(db2._connection, (err, result2) => { | ||
RethinkDB.db(db2.name).table('test').indexList().run(db2._connection, (err, result2) => { | ||
@@ -269,3 +269,3 @@ expect(err).to.not.exist(); | ||
expect(err).to.not.exist(); | ||
RethinkDB.db(db1._name).table('test').indexList().run(db1._connection, (err, result1) => { | ||
RethinkDB.db(db1.name).table('test').indexList().run(db1._connection, (err, result1) => { | ||
@@ -284,3 +284,3 @@ expect(err).to.not.exist(); | ||
expect(err).to.not.exist(); | ||
RethinkDB.db(db2._name).table('test').indexList().run(db2._connection, (err, result2) => { | ||
RethinkDB.db(db2.name).table('test').indexList().run(db2._connection, (err, result2) => { | ||
@@ -411,3 +411,3 @@ expect(err).to.not.exist(); | ||
RethinkDB.dbDrop(db._name).run(db._connection, (err, dropped) => { | ||
RethinkDB.dbDrop(db.name).run(db._connection, (err, dropped) => { | ||
@@ -414,0 +414,0 @@ expect(err).to.exist(); |
@@ -27,2 +27,13 @@ 'use strict'; | ||
it('exposes table name', (done) => { | ||
const db = new Penseur.Db('penseurtest'); | ||
db.establish(['test'], (err) => { | ||
expect(err).to.not.exist(); | ||
expect(db.test.name).to.equal('test'); | ||
done(); | ||
}); | ||
}); | ||
it('fails on database error', (done) => { | ||
@@ -29,0 +40,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78591
1877