Comparing version 1.0.2 to 1.1.0
@@ -73,3 +73,4 @@ var Result = require('./pg').Result | ||
if(cb) { | ||
cb(null, this._rows) | ||
this._result.rows = this._rows | ||
cb(null, this._rows, this._result) | ||
} | ||
@@ -76,0 +77,0 @@ this._rows = [] |
{ | ||
"name": "pg-cursor", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -62,3 +62,3 @@ node-pg-cursor | ||
#### cursor#read(int rowCount, function callback(Error err, Array rows) | ||
#### cursor#read(int rowCount, function callback(Error err, Array rows, Result result) | ||
@@ -69,2 +69,3 @@ Read `rowCount` rows from the cursor instance. The `callback` will be called when the rows are available, loaded into memory, parsed, and converted to JavaScript types. | ||
`result` is a special [https://github.com/brianc/node-postgres/wiki/Query#result-object](Result) object that can be used to accumulate rows. | ||
@@ -71,0 +72,0 @@ #### cursor#close(function callback(Error err)) |
@@ -119,2 +119,13 @@ var assert = require('assert') | ||
}) | ||
it('returns result along with rows', function(done) { | ||
var cursor = this.pgCursor(text) | ||
cursor.read(1, function(err, rows, result) { | ||
assert.ifError(err) | ||
assert.equal(rows.length, 1) | ||
assert.strictEqual(rows, result.rows) | ||
assert.deepEqual(result.fields.map(f => f.name), ['num']) | ||
done() | ||
}) | ||
}) | ||
}) |
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
15075
365
104