@avidian/duckdb-bun 0.0.0-stage → 1.0.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/LICENSE +22 -0
- package/README.md +284 -2
- package/package.json +95 -4
- package/src/bindings/api/appender.ts +288 -0
- package/src/bindings/api/data-chunk.ts +58 -0
- package/src/bindings/api/database.ts +232 -0
- package/src/bindings/api/datetime.ts +158 -0
- package/src/bindings/api/index.ts +13 -0
- package/src/bindings/api/logical-types.ts +227 -0
- package/src/bindings/api/query.ts +616 -0
- package/src/bindings/api/scalar-function.ts +274 -0
- package/src/bindings/api/table-function.ts +339 -0
- package/src/bindings/api/values.ts +546 -0
- package/src/bindings/api/vector.ts +266 -0
- package/src/bindings/generated/capi.ts +695 -0
- package/src/bindings/generated/contract.ts +162 -0
- package/src/bindings/index.ts +10 -0
- package/src/bindings/runtime/convert.ts +307 -0
- package/src/bindings/runtime/diagnostics.ts +45 -0
- package/src/bindings/runtime/dispatch.ts +200 -0
- package/src/bindings/runtime/exception.ts +103 -0
- package/src/bindings/runtime/flags.ts +19 -0
- package/src/bindings/runtime/handle.ts +217 -0
- package/src/bindings/runtime/kinds.ts +53 -0
- package/src/bindings/runtime/marshal.ts +190 -0
- package/src/bindings/runtime/native.ts +150 -0
- package/src/bindings/runtime/ring.ts +54 -0
- package/src/bindings/runtime/scope.ts +133 -0
- package/src/bindings/runtime/trace.ts +65 -0
- package/src/connection.ts +35 -0
- package/src/database.ts +27 -0
- package/src/errors.ts +30 -0
- package/src/file-assets.d.ts +10 -0
- package/src/index.ts +17 -0
- package/src/library.ts +83 -0
- package/src/neo.ts +16 -0
- package/src/reader.ts +47 -0
- package/src/statement.ts +61 -0
- package/src/types.ts +52 -0
- package/src/version.ts +6 -0
- package/vendor/node-api/LICENSE +7 -0
- package/vendor/node-api/PROVENANCE.md +54 -0
- package/vendor/node-api/node-bindings.d.ts +1669 -0
- package/vendor/node-api/src/DuckDBAppender.ts +237 -0
- package/vendor/node-api/src/DuckDBClientContext.ts +13 -0
- package/vendor/node-api/src/DuckDBConnection.ts +315 -0
- package/vendor/node-api/src/DuckDBDataChunk.ts +412 -0
- package/vendor/node-api/src/DuckDBDataChunkWriter.ts +144 -0
- package/vendor/node-api/src/DuckDBExtractedStatements.ts +37 -0
- package/vendor/node-api/src/DuckDBInstance.ts +35 -0
- package/vendor/node-api/src/DuckDBInstanceCache.ts +29 -0
- package/vendor/node-api/src/DuckDBLogicalType.ts +446 -0
- package/vendor/node-api/src/DuckDBMaterializedResult.ts +39 -0
- package/vendor/node-api/src/DuckDBPendingResult.ts +83 -0
- package/vendor/node-api/src/DuckDBPreparedStatement.ts +376 -0
- package/vendor/node-api/src/DuckDBPreparedStatementCollection.ts +5 -0
- package/vendor/node-api/src/DuckDBPreparedStatementWeakRefCollection.ts +31 -0
- package/vendor/node-api/src/DuckDBResult.ts +403 -0
- package/vendor/node-api/src/DuckDBResultReader.ts +283 -0
- package/vendor/node-api/src/DuckDBScalarFunction.ts +149 -0
- package/vendor/node-api/src/DuckDBScalarFunctionBindInfo.ts +34 -0
- package/vendor/node-api/src/DuckDBScalarFunctionInfo.ts +34 -0
- package/vendor/node-api/src/DuckDBScalarFunctionInitInfo.ts +35 -0
- package/vendor/node-api/src/DuckDBTableFunction.ts +149 -0
- package/vendor/node-api/src/DuckDBTableFunctionBindInfo.ts +56 -0
- package/vendor/node-api/src/DuckDBTableFunctionInfo.ts +36 -0
- package/vendor/node-api/src/DuckDBTableFunctionInitInfo.ts +52 -0
- package/vendor/node-api/src/DuckDBType.ts +1 -0
- package/vendor/node-api/src/DuckDBTypeId.ts +46 -0
- package/vendor/node-api/src/DuckDBValueConverter.ts +23 -0
- package/vendor/node-api/src/DuckDBValueConverters.ts +461 -0
- package/vendor/node-api/src/DuckDBVector.ts +1 -0
- package/vendor/node-api/src/JS.ts +11 -0
- package/vendor/node-api/src/JSDuckDBValueConverter.ts +85 -0
- package/vendor/node-api/src/JSInputTypeForTypeId.ts +101 -0
- package/vendor/node-api/src/JSToDuckDBValueConverter.ts +136 -0
- package/vendor/node-api/src/JSTypeForTypeId.ts +78 -0
- package/vendor/node-api/src/Json.ts +7 -0
- package/vendor/node-api/src/JsonDuckDBValueConverter.ts +72 -0
- package/vendor/node-api/src/JsonTypeForTypeId.ts +86 -0
- package/vendor/node-api/src/ToDuckDBValueConverter.ts +68 -0
- package/vendor/node-api/src/ToDuckDBValueConverters.ts +303 -0
- package/vendor/node-api/src/configurationOptionDescriptions.ts +13 -0
- package/vendor/node-api/src/conversion/bytesFromString.ts +5 -0
- package/vendor/node-api/src/conversion/dateTimeStringConversion.ts +343 -0
- package/vendor/node-api/src/conversion/displayStringForDuckDBValue.ts +12 -0
- package/vendor/node-api/src/conversion/stringFromBlob.ts +48 -0
- package/vendor/node-api/src/conversion/stringFromDecimal.ts +129 -0
- package/vendor/node-api/src/conversion/varintDecode.ts +42 -0
- package/vendor/node-api/src/convertColumnsFromChunks.ts +28 -0
- package/vendor/node-api/src/convertColumnsObjectFromChunks.ts +29 -0
- package/vendor/node-api/src/convertRowObjectsFromChunks.ts +21 -0
- package/vendor/node-api/src/convertRowsFromChunks.ts +16 -0
- package/vendor/node-api/src/createConfig.ts +14 -0
- package/vendor/node-api/src/createDuckDBValueConverter.ts +17 -0
- package/vendor/node-api/src/createResult.ts +15 -0
- package/vendor/node-api/src/createValue.ts +355 -0
- package/vendor/node-api/src/duckdb.ts +51 -0
- package/vendor/node-api/src/enums.ts +7 -0
- package/vendor/node-api/src/getColumnsFromChunks.ts +13 -0
- package/vendor/node-api/src/getColumnsObjectFromChunks.ts +16 -0
- package/vendor/node-api/src/getRowObjectsFromChunks.ts +13 -0
- package/vendor/node-api/src/getRowsFromChunks.ts +12 -0
- package/vendor/node-api/src/index.ts +3 -0
- package/vendor/node-api/src/readValue.ts +31 -0
- package/vendor/node-api/src/sleep.ts +5 -0
- package/vendor/node-api/src/sql.ts +7 -0
- package/vendor/node-api/src/tsconfig.json +7 -0
- package/vendor/node-api/src/typeForValue.ts +144 -0
- package/vendor/node-api/src/types/BaseDuckDBType.ts +31 -0
- package/vendor/node-api/src/types/DuckDBAnyType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBArrayType.ts +43 -0
- package/vendor/node-api/src/types/DuckDBBigIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBBigNumType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBBitType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBBlobType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBBooleanType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBDateType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBDecimalType.ts +46 -0
- package/vendor/node-api/src/types/DuckDBDoubleType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBEnumType.ts +111 -0
- package/vendor/node-api/src/types/DuckDBFloatType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBGeometryType.ts +36 -0
- package/vendor/node-api/src/types/DuckDBHugeIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBIntegerLiteralType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBIntegerType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBIntervalType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBListType.ts +35 -0
- package/vendor/node-api/src/types/DuckDBMapType.ts +47 -0
- package/vendor/node-api/src/types/DuckDBSQLNullType.ts +17 -0
- package/vendor/node-api/src/types/DuckDBSmallIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBStringLiteralType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBStructType.ts +104 -0
- package/vendor/node-api/src/types/DuckDBTimeNSType.ts +20 -0
- package/vendor/node-api/src/types/DuckDBTimeTZType.ts +23 -0
- package/vendor/node-api/src/types/DuckDBTimeType.ts +20 -0
- package/vendor/node-api/src/types/DuckDBTimestampMillisecondsType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBTimestampNanosecondsType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBTimestampSecondsType.ts +29 -0
- package/vendor/node-api/src/types/DuckDBTimestampTZNanosecondsType.ts +32 -0
- package/vendor/node-api/src/types/DuckDBTimestampTZType.ts +32 -0
- package/vendor/node-api/src/types/DuckDBTimestampType.ts +32 -0
- package/vendor/node-api/src/types/DuckDBTinyIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBType.ts +86 -0
- package/vendor/node-api/src/types/DuckDBUBigIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUHugeIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUIntegerType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUSmallIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUTinyIntType.ts +21 -0
- package/vendor/node-api/src/types/DuckDBUUIDType.ts +20 -0
- package/vendor/node-api/src/types/DuckDBUnionType.ts +74 -0
- package/vendor/node-api/src/types/DuckDBVarCharType.ts +13 -0
- package/vendor/node-api/src/types/DuckDBVariantType.ts +13 -0
- package/vendor/node-api/src/types/index.ts +44 -0
- package/vendor/node-api/src/values/DuckDBArrayValue.ts +18 -0
- package/vendor/node-api/src/values/DuckDBBitValue.ts +117 -0
- package/vendor/node-api/src/values/DuckDBBlobValue.ts +26 -0
- package/vendor/node-api/src/values/DuckDBDateValue.ts +43 -0
- package/vendor/node-api/src/values/DuckDBDecimalValue.ts +44 -0
- package/vendor/node-api/src/values/DuckDBGeometryValue.ts +30 -0
- package/vendor/node-api/src/values/DuckDBIntervalValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBListValue.ts +18 -0
- package/vendor/node-api/src/values/DuckDBMapValue.ts +25 -0
- package/vendor/node-api/src/values/DuckDBStructValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBTimeNSValue.ts +23 -0
- package/vendor/node-api/src/values/DuckDBTimeTZValue.ts +96 -0
- package/vendor/node-api/src/values/DuckDBTimeValue.ts +34 -0
- package/vendor/node-api/src/values/DuckDBTimestampMillisecondsValue.ts +29 -0
- package/vendor/node-api/src/values/DuckDBTimestampNanosecondsValue.ts +28 -0
- package/vendor/node-api/src/values/DuckDBTimestampSecondsValue.ts +28 -0
- package/vendor/node-api/src/values/DuckDBTimestampTZNanosecondsValue.ts +44 -0
- package/vendor/node-api/src/values/DuckDBTimestampTZValue.ts +54 -0
- package/vendor/node-api/src/values/DuckDBTimestampValue.ts +45 -0
- package/vendor/node-api/src/values/DuckDBTupleValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBUUIDValue.ts +48 -0
- package/vendor/node-api/src/values/DuckDBUnionValue.ts +22 -0
- package/vendor/node-api/src/values/DuckDBValue.ts +53 -0
- package/vendor/node-api/src/values/DuckDBVariantValue.ts +34 -0
- package/vendor/node-api/src/values/index.ts +24 -0
- package/vendor/node-api/src/vectors/DuckDBArrayVector.ts +107 -0
- package/vendor/node-api/src/vectors/DuckDBBigIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBBigNumVector.ts +98 -0
- package/vendor/node-api/src/vectors/DuckDBBitVector.ts +102 -0
- package/vendor/node-api/src/vectors/DuckDBBlobVector.ts +112 -0
- package/vendor/node-api/src/vectors/DuckDBBooleanVector.ts +84 -0
- package/vendor/node-api/src/vectors/DuckDBDateVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal128Vector.ts +107 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal16Vector.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal32Vector.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBDecimal64Vector.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBDoubleVector.ts +68 -0
- package/vendor/node-api/src/vectors/DuckDBEnum16Vector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBEnum32Vector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBEnum8Vector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBFloatVector.ts +68 -0
- package/vendor/node-api/src/vectors/DuckDBGeometryVector.ts +97 -0
- package/vendor/node-api/src/vectors/DuckDBHugeIntVector.ts +89 -0
- package/vendor/node-api/src/vectors/DuckDBIntegerVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBIntervalVector.ts +100 -0
- package/vendor/node-api/src/vectors/DuckDBListVector.ts +221 -0
- package/vendor/node-api/src/vectors/DuckDBMapVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBSQLNullVector.ts +53 -0
- package/vendor/node-api/src/vectors/DuckDBSmallIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBStructVector.ts +138 -0
- package/vendor/node-api/src/vectors/DuckDBTimeNSVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBTimeTZVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBTimeVector.ts +80 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampMillisecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampNanosecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampSecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampTZNanosecondsVector.ts +88 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampTZVector.ts +86 -0
- package/vendor/node-api/src/vectors/DuckDBTimestampVector.ts +83 -0
- package/vendor/node-api/src/vectors/DuckDBTinyIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBTupleVector.ts +125 -0
- package/vendor/node-api/src/vectors/DuckDBUBigIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUHugeIntVector.ts +89 -0
- package/vendor/node-api/src/vectors/DuckDBUIntegerVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUSmallIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUTinyIntVector.ts +75 -0
- package/vendor/node-api/src/vectors/DuckDBUUIDVector.ts +89 -0
- package/vendor/node-api/src/vectors/DuckDBUnionVector.ts +84 -0
- package/vendor/node-api/src/vectors/DuckDBValidity.ts +104 -0
- package/vendor/node-api/src/vectors/DuckDBVarCharVector.ts +100 -0
- package/vendor/node-api/src/vectors/DuckDBVariantVector.ts +609 -0
- package/vendor/node-api/src/vectors/DuckDBVector.ts +33 -0
- package/vendor/node-api/src/vectors/createVector.ts +269 -0
- package/vendor/node-api/src/vectors/dataAccessors.ts +387 -0
- package/vendor/node-api/src/vectors/index.ts +50 -0
- package/vendor/node-api/src/vectors/vectorRegistry.ts +24 -0
- package/vendor/node-api/src/version.ts +5 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import duckdb from "../../../src/bindings/index.ts";
|
|
2
|
+
import {
|
|
3
|
+
DuckDBAnyType,
|
|
4
|
+
DuckDBArrayType,
|
|
5
|
+
DuckDBBigIntType,
|
|
6
|
+
DuckDBBigNumType,
|
|
7
|
+
DuckDBBitType,
|
|
8
|
+
DuckDBBlobType,
|
|
9
|
+
DuckDBBooleanType,
|
|
10
|
+
DuckDBDateType,
|
|
11
|
+
DuckDBDecimalType,
|
|
12
|
+
DuckDBDoubleType,
|
|
13
|
+
DuckDBEnumType,
|
|
14
|
+
DuckDBFloatType,
|
|
15
|
+
DuckDBGeometryType,
|
|
16
|
+
DuckDBHugeIntType,
|
|
17
|
+
DuckDBIntegerLiteralType,
|
|
18
|
+
DuckDBIntegerType,
|
|
19
|
+
DuckDBIntervalType,
|
|
20
|
+
DuckDBListType,
|
|
21
|
+
DuckDBMapType,
|
|
22
|
+
DuckDBSQLNullType,
|
|
23
|
+
DuckDBSmallIntType,
|
|
24
|
+
DuckDBStringLiteralType,
|
|
25
|
+
DuckDBStructType,
|
|
26
|
+
DuckDBTimeNSType,
|
|
27
|
+
DuckDBTimeTZType,
|
|
28
|
+
DuckDBTimeType,
|
|
29
|
+
DuckDBTimestampMillisecondsType,
|
|
30
|
+
DuckDBTimestampNanosecondsType,
|
|
31
|
+
DuckDBTimestampSecondsType,
|
|
32
|
+
DuckDBTimestampTZType,
|
|
33
|
+
DuckDBTimestampTZNanosecondsType,
|
|
34
|
+
DuckDBTimestampType,
|
|
35
|
+
DuckDBTinyIntType,
|
|
36
|
+
DuckDBType,
|
|
37
|
+
DuckDBUBigIntType,
|
|
38
|
+
DuckDBUHugeIntType,
|
|
39
|
+
DuckDBUIntegerType,
|
|
40
|
+
DuckDBUSmallIntType,
|
|
41
|
+
DuckDBUTinyIntType,
|
|
42
|
+
DuckDBUUIDType,
|
|
43
|
+
DuckDBUnionType,
|
|
44
|
+
DuckDBVarCharType,
|
|
45
|
+
DuckDBVariantType,
|
|
46
|
+
} from './DuckDBType';
|
|
47
|
+
import { DuckDBTypeId } from './DuckDBTypeId';
|
|
48
|
+
|
|
49
|
+
export class DuckDBLogicalType {
|
|
50
|
+
readonly logical_type: duckdb.LogicalType;
|
|
51
|
+
protected constructor(logical_type: duckdb.LogicalType) {
|
|
52
|
+
this.logical_type = logical_type;
|
|
53
|
+
}
|
|
54
|
+
static create(logical_type: duckdb.LogicalType): DuckDBLogicalType {
|
|
55
|
+
switch (duckdb.get_type_id(logical_type)) {
|
|
56
|
+
case duckdb.Type.DECIMAL:
|
|
57
|
+
return new DuckDBDecimalLogicalType(logical_type);
|
|
58
|
+
case duckdb.Type.ENUM:
|
|
59
|
+
return new DuckDBEnumLogicalType(logical_type);
|
|
60
|
+
case duckdb.Type.LIST:
|
|
61
|
+
return new DuckDBListLogicalType(logical_type);
|
|
62
|
+
case duckdb.Type.STRUCT:
|
|
63
|
+
return new DuckDBStructLogicalType(logical_type);
|
|
64
|
+
case duckdb.Type.MAP:
|
|
65
|
+
return new DuckDBMapLogicalType(logical_type);
|
|
66
|
+
case duckdb.Type.ARRAY:
|
|
67
|
+
return new DuckDBArrayLogicalType(logical_type);
|
|
68
|
+
case duckdb.Type.UNION:
|
|
69
|
+
return new DuckDBUnionLogicalType(logical_type);
|
|
70
|
+
case duckdb.Type.GEOMETRY:
|
|
71
|
+
return new DuckDBGeometryLogicalType(logical_type);
|
|
72
|
+
default:
|
|
73
|
+
return new DuckDBLogicalType(logical_type);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
public static createDecimal(
|
|
77
|
+
width: number,
|
|
78
|
+
scale: number
|
|
79
|
+
): DuckDBDecimalLogicalType {
|
|
80
|
+
return new DuckDBDecimalLogicalType(
|
|
81
|
+
duckdb.create_decimal_type(width, scale)
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
public static createEnum(
|
|
85
|
+
member_names: readonly string[]
|
|
86
|
+
): DuckDBEnumLogicalType {
|
|
87
|
+
return new DuckDBEnumLogicalType(duckdb.create_enum_type(member_names));
|
|
88
|
+
}
|
|
89
|
+
public static createList(
|
|
90
|
+
valueType: DuckDBLogicalType
|
|
91
|
+
): DuckDBListLogicalType {
|
|
92
|
+
return new DuckDBListLogicalType(
|
|
93
|
+
duckdb.create_list_type(valueType.logical_type)
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
public static createStruct(
|
|
97
|
+
entryNames: readonly string[],
|
|
98
|
+
entryLogicalTypes: readonly DuckDBLogicalType[]
|
|
99
|
+
): DuckDBStructLogicalType {
|
|
100
|
+
const length = entryNames.length;
|
|
101
|
+
if (length !== entryLogicalTypes.length) {
|
|
102
|
+
throw new Error(`Could not create struct: \
|
|
103
|
+
entryNames length (${entryNames.length}) does not match entryLogicalTypes length (${entryLogicalTypes.length})`);
|
|
104
|
+
}
|
|
105
|
+
const member_types: duckdb.LogicalType[] = [];
|
|
106
|
+
const member_names: string[] = [];
|
|
107
|
+
for (let i = 0; i < length; i++) {
|
|
108
|
+
member_types.push(entryLogicalTypes[i].logical_type);
|
|
109
|
+
member_names.push(entryNames[i]);
|
|
110
|
+
}
|
|
111
|
+
return new DuckDBStructLogicalType(
|
|
112
|
+
duckdb.create_struct_type(member_types, member_names)
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
public static createMap(
|
|
116
|
+
keyType: DuckDBLogicalType,
|
|
117
|
+
valueType: DuckDBLogicalType
|
|
118
|
+
): DuckDBMapLogicalType {
|
|
119
|
+
return new DuckDBMapLogicalType(
|
|
120
|
+
duckdb.create_map_type(keyType.logical_type, valueType.logical_type)
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
public static createArray(
|
|
124
|
+
valueType: DuckDBLogicalType,
|
|
125
|
+
length: number
|
|
126
|
+
): DuckDBArrayLogicalType {
|
|
127
|
+
return new DuckDBArrayLogicalType(
|
|
128
|
+
duckdb.create_array_type(valueType.logical_type, length)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
public static createUnion(
|
|
132
|
+
memberTags: readonly string[],
|
|
133
|
+
memberLogicalTypes: readonly DuckDBLogicalType[]
|
|
134
|
+
): DuckDBUnionLogicalType {
|
|
135
|
+
const length = memberTags.length;
|
|
136
|
+
if (length !== memberLogicalTypes.length) {
|
|
137
|
+
throw new Error(`Could not create union: \
|
|
138
|
+
memberTags length (${memberTags.length}) does not match memberLogicalTypes length (${memberLogicalTypes.length})`);
|
|
139
|
+
}
|
|
140
|
+
const member_types: duckdb.LogicalType[] = [];
|
|
141
|
+
const member_names: string[] = [];
|
|
142
|
+
for (let i = 0; i < length; i++) {
|
|
143
|
+
member_types.push(memberLogicalTypes[i].logical_type);
|
|
144
|
+
member_names.push(memberTags[i]);
|
|
145
|
+
}
|
|
146
|
+
return new DuckDBUnionLogicalType(
|
|
147
|
+
duckdb.create_union_type(member_types, member_names)
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
public get typeId(): DuckDBTypeId {
|
|
151
|
+
return duckdb.get_type_id(this.logical_type) as number as DuckDBTypeId;
|
|
152
|
+
}
|
|
153
|
+
public get alias(): string | undefined {
|
|
154
|
+
return duckdb.logical_type_get_alias(this.logical_type) || undefined;
|
|
155
|
+
}
|
|
156
|
+
public set alias(newAlias: string | null | undefined) {
|
|
157
|
+
duckdb.logical_type_set_alias(this.logical_type, newAlias || '');
|
|
158
|
+
}
|
|
159
|
+
public asType(): DuckDBType {
|
|
160
|
+
const alias = this.alias;
|
|
161
|
+
switch (this.typeId) {
|
|
162
|
+
case DuckDBTypeId.BOOLEAN:
|
|
163
|
+
return DuckDBBooleanType.create(alias);
|
|
164
|
+
case DuckDBTypeId.TINYINT:
|
|
165
|
+
return DuckDBTinyIntType.create(alias);
|
|
166
|
+
case DuckDBTypeId.SMALLINT:
|
|
167
|
+
return DuckDBSmallIntType.create(alias);
|
|
168
|
+
case DuckDBTypeId.INTEGER:
|
|
169
|
+
return DuckDBIntegerType.create(alias);
|
|
170
|
+
case DuckDBTypeId.BIGINT:
|
|
171
|
+
return DuckDBBigIntType.create(alias);
|
|
172
|
+
case DuckDBTypeId.UTINYINT:
|
|
173
|
+
return DuckDBUTinyIntType.create(alias);
|
|
174
|
+
case DuckDBTypeId.USMALLINT:
|
|
175
|
+
return DuckDBUSmallIntType.create(alias);
|
|
176
|
+
case DuckDBTypeId.UINTEGER:
|
|
177
|
+
return DuckDBUIntegerType.create(alias);
|
|
178
|
+
case DuckDBTypeId.UBIGINT:
|
|
179
|
+
return DuckDBUBigIntType.create(alias);
|
|
180
|
+
case DuckDBTypeId.FLOAT:
|
|
181
|
+
return DuckDBFloatType.create(alias);
|
|
182
|
+
case DuckDBTypeId.DOUBLE:
|
|
183
|
+
return DuckDBDoubleType.create(alias);
|
|
184
|
+
case DuckDBTypeId.TIMESTAMP:
|
|
185
|
+
return DuckDBTimestampType.create(alias);
|
|
186
|
+
case DuckDBTypeId.DATE:
|
|
187
|
+
return DuckDBDateType.create(alias);
|
|
188
|
+
case DuckDBTypeId.TIME:
|
|
189
|
+
return DuckDBTimeType.create(alias);
|
|
190
|
+
case DuckDBTypeId.INTERVAL:
|
|
191
|
+
return DuckDBIntervalType.create(alias);
|
|
192
|
+
case DuckDBTypeId.HUGEINT:
|
|
193
|
+
return DuckDBHugeIntType.create(alias);
|
|
194
|
+
case DuckDBTypeId.UHUGEINT:
|
|
195
|
+
return DuckDBUHugeIntType.create(alias);
|
|
196
|
+
case DuckDBTypeId.VARCHAR:
|
|
197
|
+
return DuckDBVarCharType.create(alias);
|
|
198
|
+
case DuckDBTypeId.BLOB:
|
|
199
|
+
return DuckDBBlobType.create(alias);
|
|
200
|
+
case DuckDBTypeId.DECIMAL:
|
|
201
|
+
throw new Error('Expected override');
|
|
202
|
+
case DuckDBTypeId.TIMESTAMP_S:
|
|
203
|
+
return DuckDBTimestampSecondsType.create(alias);
|
|
204
|
+
case DuckDBTypeId.TIMESTAMP_MS:
|
|
205
|
+
return DuckDBTimestampMillisecondsType.create(alias);
|
|
206
|
+
case DuckDBTypeId.TIMESTAMP_NS:
|
|
207
|
+
return DuckDBTimestampNanosecondsType.create(alias);
|
|
208
|
+
case DuckDBTypeId.ENUM:
|
|
209
|
+
throw new Error('Expected override');
|
|
210
|
+
case DuckDBTypeId.LIST:
|
|
211
|
+
throw new Error('Expected override');
|
|
212
|
+
case DuckDBTypeId.STRUCT:
|
|
213
|
+
throw new Error('Expected override');
|
|
214
|
+
case DuckDBTypeId.MAP:
|
|
215
|
+
throw new Error('Expected override');
|
|
216
|
+
case DuckDBTypeId.ARRAY:
|
|
217
|
+
throw new Error('Expected override');
|
|
218
|
+
case DuckDBTypeId.UUID:
|
|
219
|
+
return DuckDBUUIDType.create(alias);
|
|
220
|
+
case DuckDBTypeId.UNION:
|
|
221
|
+
throw new Error('Expected override');
|
|
222
|
+
case DuckDBTypeId.BIT:
|
|
223
|
+
return DuckDBBitType.create(alias);
|
|
224
|
+
case DuckDBTypeId.TIME_TZ:
|
|
225
|
+
return DuckDBTimeTZType.create(alias);
|
|
226
|
+
case DuckDBTypeId.TIMESTAMP_TZ:
|
|
227
|
+
return DuckDBTimestampTZType.create(alias);
|
|
228
|
+
case DuckDBTypeId.ANY:
|
|
229
|
+
return DuckDBAnyType.create(alias);
|
|
230
|
+
case DuckDBTypeId.BIGNUM:
|
|
231
|
+
return DuckDBBigNumType.create(alias);
|
|
232
|
+
case DuckDBTypeId.SQLNULL:
|
|
233
|
+
return DuckDBSQLNullType.create(alias);
|
|
234
|
+
case DuckDBTypeId.STRING_LITERAL:
|
|
235
|
+
return DuckDBStringLiteralType.create(alias);
|
|
236
|
+
case DuckDBTypeId.INTEGER_LITERAL:
|
|
237
|
+
return DuckDBIntegerLiteralType.create(alias);
|
|
238
|
+
case DuckDBTypeId.TIME_NS:
|
|
239
|
+
return DuckDBTimeNSType.create(alias);
|
|
240
|
+
case DuckDBTypeId.GEOMETRY:
|
|
241
|
+
throw new Error('Expected override');
|
|
242
|
+
case DuckDBTypeId.VARIANT:
|
|
243
|
+
return DuckDBVariantType.create(alias);
|
|
244
|
+
case DuckDBTypeId.TIMESTAMP_TZ_NS:
|
|
245
|
+
return DuckDBTimestampTZNanosecondsType.create(alias);
|
|
246
|
+
default:
|
|
247
|
+
throw new Error(`Unexpected type id: ${this.typeId}`);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export class DuckDBDecimalLogicalType extends DuckDBLogicalType {
|
|
253
|
+
public get width(): number {
|
|
254
|
+
return duckdb.decimal_width(this.logical_type);
|
|
255
|
+
}
|
|
256
|
+
public get scale(): number {
|
|
257
|
+
return duckdb.decimal_scale(this.logical_type);
|
|
258
|
+
}
|
|
259
|
+
public get internalTypeId(): DuckDBTypeId {
|
|
260
|
+
return duckdb.decimal_internal_type(
|
|
261
|
+
this.logical_type
|
|
262
|
+
) as number as DuckDBTypeId;
|
|
263
|
+
}
|
|
264
|
+
public override asType(): DuckDBDecimalType {
|
|
265
|
+
return new DuckDBDecimalType(this.width, this.scale, this.alias);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export class DuckDBEnumLogicalType extends DuckDBLogicalType {
|
|
270
|
+
public get valueCount(): number {
|
|
271
|
+
return duckdb.enum_dictionary_size(this.logical_type);
|
|
272
|
+
}
|
|
273
|
+
public value(index: number): string {
|
|
274
|
+
return duckdb.enum_dictionary_value(this.logical_type, index);
|
|
275
|
+
}
|
|
276
|
+
public values(): readonly string[] {
|
|
277
|
+
const values: string[] = [];
|
|
278
|
+
const count = this.valueCount;
|
|
279
|
+
for (let i = 0; i < count; i++) {
|
|
280
|
+
values.push(this.value(i));
|
|
281
|
+
}
|
|
282
|
+
return values;
|
|
283
|
+
}
|
|
284
|
+
public get internalTypeId(): DuckDBTypeId {
|
|
285
|
+
return duckdb.enum_internal_type(
|
|
286
|
+
this.logical_type
|
|
287
|
+
) as number as DuckDBTypeId;
|
|
288
|
+
}
|
|
289
|
+
public override asType(): DuckDBEnumType {
|
|
290
|
+
return new DuckDBEnumType(this.values(), this.internalTypeId, this.alias);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export class DuckDBListLogicalType extends DuckDBLogicalType {
|
|
295
|
+
public get valueType(): DuckDBLogicalType {
|
|
296
|
+
return DuckDBLogicalType.create(
|
|
297
|
+
duckdb.list_type_child_type(this.logical_type)
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
public override asType(): DuckDBListType {
|
|
301
|
+
return new DuckDBListType(this.valueType.asType(), this.alias);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export class DuckDBStructLogicalType extends DuckDBLogicalType {
|
|
306
|
+
public get entryCount(): number {
|
|
307
|
+
return duckdb.struct_type_child_count(this.logical_type);
|
|
308
|
+
}
|
|
309
|
+
public entryName(index: number): string {
|
|
310
|
+
return duckdb.struct_type_child_name(this.logical_type, index);
|
|
311
|
+
}
|
|
312
|
+
public entryLogicalType(index: number): DuckDBLogicalType {
|
|
313
|
+
return DuckDBLogicalType.create(
|
|
314
|
+
duckdb.struct_type_child_type(this.logical_type, index)
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
public entryType(index: number): DuckDBType {
|
|
318
|
+
return this.entryLogicalType(index).asType();
|
|
319
|
+
}
|
|
320
|
+
public entryNames(): string[] {
|
|
321
|
+
const names: string[] = [];
|
|
322
|
+
const count = this.entryCount;
|
|
323
|
+
for (let i = 0; i < count; i++) {
|
|
324
|
+
names.push(this.entryName(i));
|
|
325
|
+
}
|
|
326
|
+
return names;
|
|
327
|
+
}
|
|
328
|
+
public entryLogicalTypes(): DuckDBLogicalType[] {
|
|
329
|
+
const valueTypes: DuckDBLogicalType[] = [];
|
|
330
|
+
const count = this.entryCount;
|
|
331
|
+
for (let i = 0; i < count; i++) {
|
|
332
|
+
valueTypes.push(this.entryLogicalType(i));
|
|
333
|
+
}
|
|
334
|
+
return valueTypes;
|
|
335
|
+
}
|
|
336
|
+
public entryTypes(): DuckDBType[] {
|
|
337
|
+
const valueTypes: DuckDBType[] = [];
|
|
338
|
+
const count = this.entryCount;
|
|
339
|
+
for (let i = 0; i < count; i++) {
|
|
340
|
+
valueTypes.push(this.entryType(i));
|
|
341
|
+
}
|
|
342
|
+
return valueTypes;
|
|
343
|
+
}
|
|
344
|
+
public override asType(): DuckDBStructType {
|
|
345
|
+
return new DuckDBStructType(
|
|
346
|
+
this.entryNames(),
|
|
347
|
+
this.entryTypes(),
|
|
348
|
+
this.alias
|
|
349
|
+
);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export class DuckDBMapLogicalType extends DuckDBLogicalType {
|
|
354
|
+
public get keyType(): DuckDBLogicalType {
|
|
355
|
+
return DuckDBLogicalType.create(
|
|
356
|
+
duckdb.map_type_key_type(this.logical_type)
|
|
357
|
+
);
|
|
358
|
+
}
|
|
359
|
+
public get valueType(): DuckDBLogicalType {
|
|
360
|
+
return DuckDBLogicalType.create(
|
|
361
|
+
duckdb.map_type_value_type(this.logical_type)
|
|
362
|
+
);
|
|
363
|
+
}
|
|
364
|
+
public override asType(): DuckDBMapType {
|
|
365
|
+
return new DuckDBMapType(
|
|
366
|
+
this.keyType.asType(),
|
|
367
|
+
this.valueType.asType(),
|
|
368
|
+
this.alias
|
|
369
|
+
);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export class DuckDBArrayLogicalType extends DuckDBLogicalType {
|
|
374
|
+
public get valueType(): DuckDBLogicalType {
|
|
375
|
+
return DuckDBLogicalType.create(
|
|
376
|
+
duckdb.array_type_child_type(this.logical_type)
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
public get length(): number {
|
|
380
|
+
return duckdb.array_type_array_size(this.logical_type);
|
|
381
|
+
}
|
|
382
|
+
public override asType(): DuckDBArrayType {
|
|
383
|
+
return new DuckDBArrayType(
|
|
384
|
+
this.valueType.asType(),
|
|
385
|
+
this.length,
|
|
386
|
+
this.alias
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export class DuckDBUnionLogicalType extends DuckDBLogicalType {
|
|
392
|
+
public get memberCount(): number {
|
|
393
|
+
return duckdb.union_type_member_count(this.logical_type);
|
|
394
|
+
}
|
|
395
|
+
public memberTag(index: number): string {
|
|
396
|
+
return duckdb.union_type_member_name(this.logical_type, index);
|
|
397
|
+
}
|
|
398
|
+
public memberLogicalType(index: number): DuckDBLogicalType {
|
|
399
|
+
return DuckDBLogicalType.create(
|
|
400
|
+
duckdb.union_type_member_type(this.logical_type, index)
|
|
401
|
+
);
|
|
402
|
+
}
|
|
403
|
+
public memberType(index: number): DuckDBType {
|
|
404
|
+
return this.memberLogicalType(index).asType();
|
|
405
|
+
}
|
|
406
|
+
public memberTags(): string[] {
|
|
407
|
+
const tags: string[] = [];
|
|
408
|
+
const count = this.memberCount;
|
|
409
|
+
for (let i = 0; i < count; i++) {
|
|
410
|
+
tags.push(this.memberTag(i));
|
|
411
|
+
}
|
|
412
|
+
return tags;
|
|
413
|
+
}
|
|
414
|
+
public memberLogicalTypes(): DuckDBLogicalType[] {
|
|
415
|
+
const valueTypes: DuckDBLogicalType[] = [];
|
|
416
|
+
const count = this.memberCount;
|
|
417
|
+
for (let i = 0; i < count; i++) {
|
|
418
|
+
valueTypes.push(this.memberLogicalType(i));
|
|
419
|
+
}
|
|
420
|
+
return valueTypes;
|
|
421
|
+
}
|
|
422
|
+
public memberTypes(): DuckDBType[] {
|
|
423
|
+
const valueTypes: DuckDBType[] = [];
|
|
424
|
+
const count = this.memberCount;
|
|
425
|
+
for (let i = 0; i < count; i++) {
|
|
426
|
+
valueTypes.push(this.memberType(i));
|
|
427
|
+
}
|
|
428
|
+
return valueTypes;
|
|
429
|
+
}
|
|
430
|
+
public override asType(): DuckDBUnionType {
|
|
431
|
+
return new DuckDBUnionType(
|
|
432
|
+
this.memberTags(),
|
|
433
|
+
this.memberTypes(),
|
|
434
|
+
this.alias
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export class DuckDBGeometryLogicalType extends DuckDBLogicalType {
|
|
440
|
+
public get crs(): string | undefined {
|
|
441
|
+
return duckdb.geometry_type_get_crs(this.logical_type) || undefined;
|
|
442
|
+
}
|
|
443
|
+
public override asType(): DuckDBGeometryType {
|
|
444
|
+
return DuckDBGeometryType.create(this.alias, this.crs);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import duckdb from "../../../src/bindings/index.ts";
|
|
2
|
+
import { DuckDBDataChunk } from './DuckDBDataChunk';
|
|
3
|
+
import { DuckDBResult } from './DuckDBResult';
|
|
4
|
+
import { StatementType } from './enums';
|
|
5
|
+
|
|
6
|
+
export class DuckDBMaterializedResult extends DuckDBResult {
|
|
7
|
+
private closedCounts: { rowCount: number; chunkCount: number } | undefined;
|
|
8
|
+
constructor(result: duckdb.Result, preparedStatementType?: StatementType) {
|
|
9
|
+
super(result, preparedStatementType);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Same as `DuckDBResult.closeSync`; the row and chunk counts also stay
|
|
13
|
+
* available. Getting a chunk throws.
|
|
14
|
+
*/
|
|
15
|
+
public override closeSync() {
|
|
16
|
+
if (!this.closedCounts) {
|
|
17
|
+
this.closedCounts = {
|
|
18
|
+
rowCount: this.rowCount,
|
|
19
|
+
chunkCount: this.chunkCount,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
super.closeSync();
|
|
23
|
+
}
|
|
24
|
+
public get rowCount(): number {
|
|
25
|
+
if (this.closedCounts) {
|
|
26
|
+
return this.closedCounts.rowCount;
|
|
27
|
+
}
|
|
28
|
+
return duckdb.row_count(this.result);
|
|
29
|
+
}
|
|
30
|
+
public get chunkCount(): number {
|
|
31
|
+
if (this.closedCounts) {
|
|
32
|
+
return this.closedCounts.chunkCount;
|
|
33
|
+
}
|
|
34
|
+
return duckdb.result_chunk_count(this.result);
|
|
35
|
+
}
|
|
36
|
+
public getChunk(chunkIndex: number): DuckDBDataChunk {
|
|
37
|
+
return new DuckDBDataChunk(duckdb.result_get_chunk(this.result, chunkIndex));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import duckdb from "../../../src/bindings/index.ts";
|
|
2
|
+
import { createResult } from './createResult';
|
|
3
|
+
import { DuckDBResult } from './DuckDBResult';
|
|
4
|
+
import { DuckDBResultReader } from './DuckDBResultReader';
|
|
5
|
+
import { StatementType } from './enums';
|
|
6
|
+
import { sleep } from './sleep';
|
|
7
|
+
|
|
8
|
+
// Values match similar enum in C API.
|
|
9
|
+
export enum DuckDBPendingResultState {
|
|
10
|
+
RESULT_READY = 0,
|
|
11
|
+
RESULT_NOT_READY = 1,
|
|
12
|
+
NO_TASKS_AVAILABLE = 3,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class DuckDBPendingResult {
|
|
16
|
+
private readonly pending_result: duckdb.PendingResult;
|
|
17
|
+
private readonly preparedStatementType: StatementType | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* `preparedStatementType` is passed on to the result; see `DuckDBResult`.
|
|
20
|
+
*/
|
|
21
|
+
constructor(
|
|
22
|
+
pending_result: duckdb.PendingResult,
|
|
23
|
+
preparedStatementType?: StatementType
|
|
24
|
+
) {
|
|
25
|
+
this.pending_result = pending_result;
|
|
26
|
+
this.preparedStatementType = preparedStatementType;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Destroys the pending result. On DuckDB 2.0, a pending result whose result
|
|
30
|
+
* has not been gotten blocks its connection from starting another statement
|
|
31
|
+
* until it is closed.
|
|
32
|
+
*
|
|
33
|
+
* Running tasks or getting the result afterwards throws. If getting the
|
|
34
|
+
* result is in flight, the pending result is destroyed once it finishes; the
|
|
35
|
+
* result it returns is unaffected. Closing again does nothing.
|
|
36
|
+
*/
|
|
37
|
+
public closeSync() {
|
|
38
|
+
duckdb.destroy_pending_sync(this.pending_result);
|
|
39
|
+
}
|
|
40
|
+
public runTask(): DuckDBPendingResultState {
|
|
41
|
+
const pending_state = duckdb.pending_execute_task(this.pending_result);
|
|
42
|
+
switch (pending_state) {
|
|
43
|
+
case duckdb.PendingState.RESULT_READY:
|
|
44
|
+
return DuckDBPendingResultState.RESULT_READY;
|
|
45
|
+
case duckdb.PendingState.RESULT_NOT_READY:
|
|
46
|
+
return DuckDBPendingResultState.RESULT_NOT_READY;
|
|
47
|
+
case duckdb.PendingState.ERROR:
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Failure running pending result task: ${duckdb.pending_error(
|
|
50
|
+
this.pending_result
|
|
51
|
+
)}`
|
|
52
|
+
);
|
|
53
|
+
case duckdb.PendingState.NO_TASKS_AVAILABLE:
|
|
54
|
+
return DuckDBPendingResultState.NO_TASKS_AVAILABLE;
|
|
55
|
+
default:
|
|
56
|
+
throw new Error(`Unexpected pending state: ${pending_state}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
public async runAllTasks(): Promise<void> {
|
|
60
|
+
while (this.runTask() !== DuckDBPendingResultState.RESULT_READY) {
|
|
61
|
+
await sleep(1);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
public async getResult(): Promise<DuckDBResult> {
|
|
65
|
+
return createResult(
|
|
66
|
+
await duckdb.execute_pending(this.pending_result),
|
|
67
|
+
this.preparedStatementType
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
public async read(): Promise<DuckDBResultReader> {
|
|
71
|
+
return new DuckDBResultReader(await this.getResult());
|
|
72
|
+
}
|
|
73
|
+
public async readAll(): Promise<DuckDBResultReader> {
|
|
74
|
+
const reader = new DuckDBResultReader(await this.getResult());
|
|
75
|
+
await reader.readAll();
|
|
76
|
+
return reader;
|
|
77
|
+
}
|
|
78
|
+
public async readUntil(targetRowCount: number): Promise<DuckDBResultReader> {
|
|
79
|
+
const reader = new DuckDBResultReader(await this.getResult());
|
|
80
|
+
await reader.readUntil(targetRowCount);
|
|
81
|
+
return reader;
|
|
82
|
+
}
|
|
83
|
+
}
|