duckdb 0.10.3-dev6.0 → 0.10.3-dev8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/duckdb.js +11 -0
- package/package.json +1 -1
- package/test/query_result.test.ts +9 -0
package/lib/duckdb.js
CHANGED
@@ -530,6 +530,17 @@ Database.prototype.each = function () {
|
|
530
530
|
return this;
|
531
531
|
}
|
532
532
|
|
533
|
+
|
534
|
+
/**
|
535
|
+
* @arg sql
|
536
|
+
* @param {...*} params
|
537
|
+
* @yields row chunks
|
538
|
+
*/
|
539
|
+
Database.prototype.stream = function() {
|
540
|
+
return default_connection(this).stream.apply(this.default_connection, arguments);
|
541
|
+
}
|
542
|
+
|
543
|
+
|
533
544
|
/**
|
534
545
|
* Convenience method for Connection#apply using a built-in default connection
|
535
546
|
* @arg sql
|
package/package.json
CHANGED
@@ -20,4 +20,13 @@ describe('QueryResult', () => {
|
|
20
20
|
}
|
21
21
|
assert.equal(total, retrieved)
|
22
22
|
})
|
23
|
+
|
24
|
+
it('streams results using the database object', async () => {
|
25
|
+
let retrieved = 0;
|
26
|
+
const stream = db.stream('SELECT * FROM range(0, ?)', total);
|
27
|
+
for await (const row of stream) {
|
28
|
+
retrieved++;
|
29
|
+
}
|
30
|
+
assert.equal(total, retrieved)
|
31
|
+
})
|
23
32
|
})
|