mysql-wrap-production
Advanced tools
Comparing version 0.7.3 to 0.7.4
{ | ||
"name": "mysql-wrap-production", | ||
"version": "0.7.3", | ||
"version": "0.7.4", | ||
"description": "Mysql interface and helper functions, wrapping node-mysql", | ||
@@ -5,0 +5,0 @@ "main": "src/mysql-wrap.js", |
@@ -139,7 +139,18 @@ 'use strict'; | ||
s.run = () => { | ||
s.run = fig => { | ||
let p = s.toParam(); | ||
return self.query(p.text, p.values); | ||
return self.query( | ||
_.extend({ sql: p.text }, fig || {}), | ||
p.values | ||
); | ||
}; | ||
s.one = fig => { | ||
let p = s.toParam(); | ||
return self.one( | ||
_.extend({ sql: p.text }, fig || {}), | ||
p.values | ||
); | ||
}; | ||
return s; | ||
@@ -146,0 +157,0 @@ }; |
@@ -56,3 +56,4 @@ 'use strict'; | ||
it('should return query generator', function (done) { | ||
this.sql.build().select().from('table').where('field = ?', 'bar').run() | ||
this.sql.build().select().from('table') | ||
.where('field = ?', this.b.field).run() | ||
.then(resp => { | ||
@@ -63,2 +64,26 @@ chai.assert.deepEqual(resp, [this.b]); | ||
}); | ||
it('should be able to pass query options through "run" command', function (done) { | ||
this.sql.build().select().from('table') | ||
.where('id = ?', this.b.id).run({ resultCount: true }) | ||
.then(resp => { | ||
chai.assert.deepEqual( | ||
resp, | ||
{ | ||
resultCount: 1, | ||
results: [this.b] | ||
} | ||
); | ||
done(); | ||
}).done(); | ||
}); | ||
it('should be invokable through a "one" command', function (done) { | ||
this.sql.build().select().from('table') | ||
.where('id = ?', this.b.id).one() | ||
.then(resp => { | ||
chai.assert.deepEqual(resp, this.b); | ||
done(); | ||
}).done(); | ||
}); | ||
}); | ||
@@ -65,0 +90,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
41025
829