@duckdb/node-api 1.4.0-r.1 → 1.4.0-r.2

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.
@@ -45,4 +45,13 @@ export declare class DuckDBResult {
45
45
  convertRowObjects<T>(converter: DuckDBValueConverter<T>): Promise<Record<string, T | null>[]>;
46
46
  getRowObjectsJS(): Promise<Record<string, JS>[]>;
47
47
  getRowObjectsJson(): Promise<Record<string, Json>[]>;
48
+ [Symbol.asyncIterator](): AsyncIterableIterator<DuckDBDataChunk>;
49
+ yieldRows(): AsyncIterableIterator<DuckDBValue[][]>;
50
+ yieldRowObjects(): AsyncIterableIterator<Record<string, DuckDBValue>[]>;
51
+ yieldConvertedRows<T>(converter: DuckDBValueConverter<T>): AsyncIterableIterator<(T | null)[][]>;
52
+ yieldConvertedRowObjects<T>(converter: DuckDBValueConverter<T>): AsyncIterableIterator<Record<string, T | null>[]>;
53
+ yieldRowsJs(): AsyncIterableIterator<JS[][]>;
54
+ yieldRowsJson(): AsyncIterableIterator<Json[][]>;
55
+ yieldRowObjectJs(): AsyncIterableIterator<Record<string, JS>[]>;
56
+ yieldRowObjectJson(): AsyncIterableIterator<Record<string, Json>[]>;
48
57
  }
@@ -180,5 +180,50 @@ class DuckDBResult {
180
180
  async getRowObjectsJson() {
181
181
  return this.convertRowObjects(JsonDuckDBValueConverter_1.JsonDuckDBValueConverter);
182
182
  }
183
+ async *[Symbol.asyncIterator]() {
184
+ while (true) {
185
+ const chunk = await this.fetchChunk();
186
+ if (chunk && chunk.rowCount > 0) {
187
+ yield chunk;
188
+ }
189
+ else {
190
+ break;
191
+ }
192
+ }
193
+ }
194
+ async *yieldRows() {
195
+ for await (const chunk of this) {
196
+ yield (0, getRowsFromChunks_1.getRowsFromChunks)([chunk]);
197
+ }
198
+ }
199
+ async *yieldRowObjects() {
200
+ const deduplicatedColumnNames = this.deduplicatedColumnNames();
201
+ for await (const chunk of this) {
202
+ yield (0, getRowObjectsFromChunks_1.getRowObjectsFromChunks)([chunk], deduplicatedColumnNames);
203
+ }
204
+ }
205
+ async *yieldConvertedRows(converter) {
206
+ for await (const chunk of this) {
207
+ yield (0, convertRowsFromChunks_1.convertRowsFromChunks)([chunk], converter);
208
+ }
209
+ }
210
+ async *yieldConvertedRowObjects(converter) {
211
+ const deduplicatedColumnNames = this.deduplicatedColumnNames();
212
+ for await (const chunk of this) {
213
+ yield (0, convertRowObjectsFromChunks_1.convertRowObjectsFromChunks)([chunk], deduplicatedColumnNames, converter);
214
+ }
215
+ }
216
+ yieldRowsJs() {
217
+ return this.yieldConvertedRows(JSDuckDBValueConverter_1.JSDuckDBValueConverter);
218
+ }
219
+ yieldRowsJson() {
220
+ return this.yieldConvertedRows(JsonDuckDBValueConverter_1.JsonDuckDBValueConverter);
221
+ }
222
+ yieldRowObjectJs() {
223
+ return this.yieldConvertedRowObjects(JSDuckDBValueConverter_1.JSDuckDBValueConverter);
224
+ }
225
+ yieldRowObjectJson() {
226
+ return this.yieldConvertedRowObjects(JsonDuckDBValueConverter_1.JsonDuckDBValueConverter);
227
+ }
183
228
  }
184
229
  exports.DuckDBResult = DuckDBResult;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@duckdb/node-api",
3
- "version": "1.4.0-r.1",
3
+ "version": "1.4.0-r.2",
4
4
  "license": "MIT",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "dependencies": {
8
- "@duckdb/node-bindings": "1.4.0-r.1"
8
+ "@duckdb/node-bindings": "1.4.0-r.2"
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",