@haybarn/node-api 1.5.6-rc1 → 2.0.0-rc3
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/README.md +315 -20
- package/lib/DuckDBAppender.d.ts +8 -2
- package/lib/DuckDBAppender.js +19 -1
- package/lib/DuckDBConnection.d.ts +2 -0
- package/lib/DuckDBConnection.js +4 -1
- package/lib/DuckDBDataChunk.d.ts +30 -0
- package/lib/DuckDBDataChunk.js +94 -1
- package/lib/DuckDBDataChunkWriter.d.ts +74 -0
- package/lib/DuckDBDataChunkWriter.js +109 -0
- package/lib/DuckDBLogicalType.d.ts +5 -1
- package/lib/DuckDBLogicalType.js +18 -1
- package/lib/DuckDBMaterializedResult.d.ts +8 -1
- package/lib/DuckDBMaterializedResult.js +22 -2
- package/lib/DuckDBPendingResult.d.ts +16 -1
- package/lib/DuckDBPendingResult.js +19 -2
- package/lib/DuckDBPreparedStatement.d.ts +4 -1
- package/lib/DuckDBPreparedStatement.js +17 -4
- package/lib/DuckDBResult.d.ts +21 -1
- package/lib/DuckDBResult.js +87 -5
- package/lib/DuckDBResultReader.d.ts +5 -0
- package/lib/DuckDBResultReader.js +9 -2
- package/lib/DuckDBScalarFunction.d.ts +9 -5
- package/lib/DuckDBScalarFunction.js +14 -5
- package/lib/DuckDBScalarFunctionBindInfo.d.ts +16 -0
- package/lib/{DuckDBBindInfo.js → DuckDBScalarFunctionBindInfo.js} +5 -3
- package/lib/DuckDBScalarFunctionInfo.d.ts +16 -0
- package/lib/{DuckDBFunctionInfo.js → DuckDBScalarFunctionInfo.js} +11 -3
- package/lib/{DuckDBBindInfo.d.ts → DuckDBScalarFunctionInitInfo.d.ts} +6 -4
- package/lib/DuckDBScalarFunctionInitInfo.js +39 -0
- package/lib/DuckDBTableFunction.d.ts +41 -0
- package/lib/DuckDBTableFunction.js +83 -0
- package/lib/DuckDBTableFunctionBindInfo.d.ts +21 -0
- package/lib/DuckDBTableFunctionBindInfo.js +54 -0
- package/lib/DuckDBTableFunctionInfo.d.ts +15 -0
- package/lib/DuckDBTableFunctionInfo.js +42 -0
- package/lib/DuckDBTableFunctionInitInfo.d.ts +22 -0
- package/lib/DuckDBTableFunctionInitInfo.js +58 -0
- package/lib/DuckDBType.d.ts +1 -373
- package/lib/DuckDBType.js +14 -927
- package/lib/DuckDBTypeId.d.ts +4 -1
- package/lib/DuckDBTypeId.js +3 -0
- package/lib/DuckDBValueConverter.d.ts +10 -0
- package/lib/DuckDBValueConverters.d.ts +27 -0
- package/lib/DuckDBValueConverters.js +128 -1
- package/lib/DuckDBVector.d.ts +1 -596
- package/lib/DuckDBVector.js +14 -2522
- package/lib/JSDuckDBValueConverter.d.ts +1 -2
- package/lib/JSDuckDBValueConverter.js +5 -2
- package/lib/JSInputTypeForTypeId.d.ts +104 -0
- package/lib/JSInputTypeForTypeId.js +3 -0
- package/lib/JSToDuckDBValueConverter.d.ts +30 -0
- package/lib/JSToDuckDBValueConverter.js +83 -0
- package/lib/JSTypeForTypeId.d.ts +91 -0
- package/lib/JSTypeForTypeId.js +3 -0
- package/lib/JsonDuckDBValueConverter.d.ts +1 -2
- package/lib/JsonDuckDBValueConverter.js +4 -1
- package/lib/JsonTypeForTypeId.d.ts +96 -0
- package/lib/JsonTypeForTypeId.js +3 -0
- package/lib/ToDuckDBValueConverter.d.ts +41 -0
- package/lib/ToDuckDBValueConverter.js +27 -0
- package/lib/ToDuckDBValueConverters.d.ts +54 -0
- package/lib/ToDuckDBValueConverters.js +199 -0
- package/lib/conversion/dateTimeStringConversion.d.ts +2 -2
- package/lib/conversion/dateTimeStringConversion.js +20 -7
- package/lib/conversion/varintDecode.d.ts +18 -0
- package/lib/conversion/varintDecode.js +42 -0
- package/lib/convertColumnsFromChunks.d.ts +1 -1
- package/lib/convertColumnsFromChunks.js +2 -2
- package/lib/createResult.d.ts +2 -1
- package/lib/createResult.js +3 -3
- package/lib/createValue.js +63 -5
- package/lib/duckdb.d.ts +15 -2
- package/lib/duckdb.js +15 -2
- package/lib/getColumnsFromChunks.d.ts +1 -1
- package/lib/getColumnsFromChunks.js +2 -2
- package/lib/getColumnsObjectFromChunks.js +3 -0
- package/lib/readValue.d.ts +22 -0
- package/lib/readValue.js +35 -0
- package/lib/typeForValue.js +21 -2
- package/lib/types/BaseDuckDBType.d.ts +11 -0
- package/lib/types/BaseDuckDBType.js +34 -0
- package/lib/types/DuckDBAnyType.d.ts +8 -0
- package/lib/types/DuckDBAnyType.js +16 -0
- package/lib/types/DuckDBArrayType.d.ts +14 -0
- package/lib/types/DuckDBArrayType.js +38 -0
- package/lib/types/DuckDBBigIntType.d.ts +12 -0
- package/lib/types/DuckDBBigIntType.js +24 -0
- package/lib/types/DuckDBBigNumType.d.ts +12 -0
- package/lib/types/DuckDBBigNumType.js +24 -0
- package/lib/types/DuckDBBitType.d.ts +8 -0
- package/lib/types/DuckDBBitType.js +16 -0
- package/lib/types/DuckDBBlobType.d.ts +8 -0
- package/lib/types/DuckDBBlobType.js +16 -0
- package/lib/types/DuckDBBooleanType.d.ts +8 -0
- package/lib/types/DuckDBBooleanType.js +16 -0
- package/lib/types/DuckDBDateType.d.ts +14 -0
- package/lib/types/DuckDBDateType.js +32 -0
- package/lib/types/DuckDBDecimalType.d.ts +14 -0
- package/lib/types/DuckDBDecimalType.js +45 -0
- package/lib/types/DuckDBDoubleType.d.ts +12 -0
- package/lib/types/DuckDBDoubleType.js +24 -0
- package/lib/types/DuckDBEnumType.d.ts +29 -0
- package/lib/types/DuckDBEnumType.js +100 -0
- package/lib/types/DuckDBFloatType.d.ts +12 -0
- package/lib/types/DuckDBFloatType.js +24 -0
- package/lib/types/DuckDBGeometryType.d.ts +19 -0
- package/lib/types/DuckDBGeometryType.js +38 -0
- package/lib/types/DuckDBHugeIntType.d.ts +12 -0
- package/lib/types/DuckDBHugeIntType.js +24 -0
- package/lib/types/DuckDBIntegerLiteralType.d.ts +8 -0
- package/lib/types/DuckDBIntegerLiteralType.js +16 -0
- package/lib/types/DuckDBIntegerType.d.ts +12 -0
- package/lib/types/DuckDBIntegerType.js +24 -0
- package/lib/types/DuckDBIntervalType.d.ts +8 -0
- package/lib/types/DuckDBIntervalType.js +16 -0
- package/lib/types/DuckDBListType.d.ts +13 -0
- package/lib/types/DuckDBListType.js +35 -0
- package/lib/types/DuckDBMapType.d.ts +14 -0
- package/lib/types/DuckDBMapType.js +38 -0
- package/lib/types/DuckDBSQLNullType.d.ts +10 -0
- package/lib/types/DuckDBSQLNullType.js +20 -0
- package/lib/types/DuckDBSmallIntType.d.ts +12 -0
- package/lib/types/DuckDBSmallIntType.js +24 -0
- package/lib/types/DuckDBStringLiteralType.d.ts +8 -0
- package/lib/types/DuckDBStringLiteralType.js +16 -0
- package/lib/types/DuckDBStructType.d.ts +29 -0
- package/lib/types/DuckDBStructType.js +86 -0
- package/lib/types/DuckDBTimeNSType.d.ts +11 -0
- package/lib/types/DuckDBTimeNSType.js +23 -0
- package/lib/types/DuckDBTimeTZType.d.ts +12 -0
- package/lib/types/DuckDBTimeTZType.js +26 -0
- package/lib/types/DuckDBTimeType.d.ts +11 -0
- package/lib/types/DuckDBTimeType.js +23 -0
- package/lib/types/DuckDBTimestampMillisecondsType.d.ts +14 -0
- package/lib/types/DuckDBTimestampMillisecondsType.js +32 -0
- package/lib/types/DuckDBTimestampNanosecondsType.d.ts +14 -0
- package/lib/types/DuckDBTimestampNanosecondsType.js +32 -0
- package/lib/types/DuckDBTimestampSecondsType.d.ts +14 -0
- package/lib/types/DuckDBTimestampSecondsType.js +32 -0
- package/lib/types/DuckDBTimestampTZNanosecondsType.d.ts +15 -0
- package/lib/types/DuckDBTimestampTZNanosecondsType.js +35 -0
- package/lib/types/DuckDBTimestampTZType.d.ts +15 -0
- package/lib/types/DuckDBTimestampTZType.js +35 -0
- package/lib/types/DuckDBTimestampType.d.ts +16 -0
- package/lib/types/DuckDBTimestampType.js +33 -0
- package/lib/types/DuckDBTinyIntType.d.ts +12 -0
- package/lib/types/DuckDBTinyIntType.js +24 -0
- package/lib/types/DuckDBType.d.ts +43 -0
- package/lib/types/DuckDBType.js +2 -0
- package/lib/types/DuckDBUBigIntType.d.ts +12 -0
- package/lib/types/DuckDBUBigIntType.js +24 -0
- package/lib/types/DuckDBUHugeIntType.d.ts +12 -0
- package/lib/types/DuckDBUHugeIntType.js +24 -0
- package/lib/types/DuckDBUIntegerType.d.ts +12 -0
- package/lib/types/DuckDBUIntegerType.js +24 -0
- package/lib/types/DuckDBUSmallIntType.d.ts +12 -0
- package/lib/types/DuckDBUSmallIntType.js +24 -0
- package/lib/types/DuckDBUTinyIntType.d.ts +12 -0
- package/lib/types/DuckDBUTinyIntType.js +24 -0
- package/lib/types/DuckDBUUIDType.d.ts +11 -0
- package/lib/types/DuckDBUUIDType.js +23 -0
- package/lib/types/DuckDBUnionType.d.ts +18 -0
- package/lib/types/DuckDBUnionType.js +64 -0
- package/lib/types/DuckDBVarCharType.d.ts +8 -0
- package/lib/types/DuckDBVarCharType.js +16 -0
- package/lib/types/DuckDBVariantType.d.ts +8 -0
- package/lib/types/DuckDBVariantType.js +16 -0
- package/lib/types/index.d.ts +44 -0
- package/lib/types/index.js +60 -0
- package/lib/values/DuckDBGeometryValue.d.ts +12 -0
- package/lib/values/DuckDBGeometryValue.js +30 -0
- package/lib/values/DuckDBTimestampTZNanosecondsValue.d.ts +14 -0
- package/lib/values/DuckDBTimestampTZNanosecondsValue.js +33 -0
- package/lib/values/DuckDBTupleValue.d.ts +11 -0
- package/lib/values/DuckDBTupleValue.js +22 -0
- package/lib/values/DuckDBUUIDValue.js +5 -1
- package/lib/values/DuckDBValue.d.ts +5 -1
- package/lib/values/DuckDBVariantValue.d.ts +19 -0
- package/lib/values/DuckDBVariantValue.js +30 -0
- package/lib/values/index.d.ts +4 -0
- package/lib/values/index.js +4 -0
- package/lib/vectors/DuckDBArrayVector.d.ts +21 -0
- package/lib/vectors/DuckDBArrayVector.js +79 -0
- package/lib/vectors/DuckDBBigIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBBigIntVector.js +58 -0
- package/lib/vectors/DuckDBBigNumVector.d.ts +21 -0
- package/lib/vectors/DuckDBBigNumVector.js +70 -0
- package/lib/vectors/DuckDBBitVector.d.ts +22 -0
- package/lib/vectors/DuckDBBitVector.js +74 -0
- package/lib/vectors/DuckDBBlobVector.d.ts +32 -0
- package/lib/vectors/DuckDBBlobVector.js +83 -0
- package/lib/vectors/DuckDBBooleanVector.d.ts +18 -0
- package/lib/vectors/DuckDBBooleanVector.js +58 -0
- package/lib/vectors/DuckDBDateVector.d.ts +18 -0
- package/lib/vectors/DuckDBDateVector.js +64 -0
- package/lib/vectors/DuckDBDecimal128Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal128Vector.js +64 -0
- package/lib/vectors/DuckDBDecimal16Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal16Vector.js +64 -0
- package/lib/vectors/DuckDBDecimal32Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal32Vector.js +64 -0
- package/lib/vectors/DuckDBDecimal64Vector.d.ts +21 -0
- package/lib/vectors/DuckDBDecimal64Vector.js +64 -0
- package/lib/vectors/DuckDBDoubleVector.d.ts +17 -0
- package/lib/vectors/DuckDBDoubleVector.js +54 -0
- package/lib/vectors/DuckDBEnum16Vector.d.ts +18 -0
- package/lib/vectors/DuckDBEnum16Vector.js +57 -0
- package/lib/vectors/DuckDBEnum32Vector.d.ts +18 -0
- package/lib/vectors/DuckDBEnum32Vector.js +57 -0
- package/lib/vectors/DuckDBEnum8Vector.d.ts +18 -0
- package/lib/vectors/DuckDBEnum8Vector.js +57 -0
- package/lib/vectors/DuckDBFloatVector.d.ts +17 -0
- package/lib/vectors/DuckDBFloatVector.js +54 -0
- package/lib/vectors/DuckDBGeometryVector.d.ts +22 -0
- package/lib/vectors/DuckDBGeometryVector.js +69 -0
- package/lib/vectors/DuckDBHugeIntVector.d.ts +19 -0
- package/lib/vectors/DuckDBHugeIntVector.js +63 -0
- package/lib/vectors/DuckDBIntegerVector.d.ts +17 -0
- package/lib/vectors/DuckDBIntegerVector.js +61 -0
- package/lib/vectors/DuckDBIntervalVector.d.ts +19 -0
- package/lib/vectors/DuckDBIntervalVector.js +67 -0
- package/lib/vectors/DuckDBListVector.d.ts +35 -0
- package/lib/vectors/DuckDBListVector.js +151 -0
- package/lib/vectors/DuckDBMapVector.d.ts +17 -0
- package/lib/vectors/DuckDBMapVector.js +60 -0
- package/lib/vectors/DuckDBSQLNullVector.d.ts +18 -0
- package/lib/vectors/DuckDBSQLNullVector.js +44 -0
- package/lib/vectors/DuckDBSmallIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBSmallIntVector.js +61 -0
- package/lib/vectors/DuckDBStructVector.d.ts +35 -0
- package/lib/vectors/DuckDBStructVector.js +105 -0
- package/lib/vectors/DuckDBTimeNSVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimeNSVector.js +61 -0
- package/lib/vectors/DuckDBTimeTZVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimeTZVector.js +61 -0
- package/lib/vectors/DuckDBTimeVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimeVector.js +61 -0
- package/lib/vectors/DuckDBTimestampMillisecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampMillisecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampNanosecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampNanosecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampSecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampSecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampTZNanosecondsVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampTZNanosecondsVector.js +61 -0
- package/lib/vectors/DuckDBTimestampTZVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampTZVector.js +61 -0
- package/lib/vectors/DuckDBTimestampVector.d.ts +18 -0
- package/lib/vectors/DuckDBTimestampVector.js +61 -0
- package/lib/vectors/DuckDBTinyIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBTinyIntVector.js +61 -0
- package/lib/vectors/DuckDBTupleVector.d.ts +26 -0
- package/lib/vectors/DuckDBTupleVector.js +91 -0
- package/lib/vectors/DuckDBUBigIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBUBigIntVector.js +58 -0
- package/lib/vectors/DuckDBUHugeIntVector.d.ts +19 -0
- package/lib/vectors/DuckDBUHugeIntVector.js +63 -0
- package/lib/vectors/DuckDBUIntegerVector.d.ts +17 -0
- package/lib/vectors/DuckDBUIntegerVector.js +61 -0
- package/lib/vectors/DuckDBUSmallIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBUSmallIntVector.js +61 -0
- package/lib/vectors/DuckDBUTinyIntVector.d.ts +17 -0
- package/lib/vectors/DuckDBUTinyIntVector.js +61 -0
- package/lib/vectors/DuckDBUUIDVector.d.ts +19 -0
- package/lib/vectors/DuckDBUUIDVector.js +59 -0
- package/lib/vectors/DuckDBUnionVector.d.ts +17 -0
- package/lib/vectors/DuckDBUnionVector.js +70 -0
- package/lib/vectors/DuckDBValidity.d.ts +12 -0
- package/lib/vectors/DuckDBValidity.js +91 -0
- package/lib/vectors/DuckDBVarCharVector.d.ts +21 -0
- package/lib/vectors/DuckDBVarCharVector.js +74 -0
- package/lib/vectors/DuckDBVariantVector.d.ts +42 -0
- package/lib/vectors/DuckDBVariantVector.js +461 -0
- package/lib/vectors/DuckDBVector.d.ts +14 -0
- package/lib/vectors/DuckDBVector.js +27 -0
- package/lib/vectors/createVector.d.ts +1 -0
- package/lib/vectors/createVector.js +201 -0
- package/lib/vectors/dataAccessors.d.ts +45 -0
- package/lib/vectors/dataAccessors.js +344 -0
- package/lib/vectors/index.d.ts +47 -0
- package/lib/vectors/index.js +65 -0
- package/lib/vectors/vectorRegistry.d.ts +20 -0
- package/lib/vectors/vectorRegistry.js +16 -0
- package/package.json +3 -2
- package/lib/DuckDBFunctionInfo.d.ts +0 -10
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import type { DuckDBType } from './DuckDBType';
|
|
3
|
+
import { DuckDBLogicalType } from '../DuckDBLogicalType';
|
|
4
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
5
|
+
import { Json } from '../Json';
|
|
6
|
+
export declare class DuckDBUnionType extends BaseDuckDBType<DuckDBTypeId.UNION> {
|
|
7
|
+
readonly memberTags: readonly string[];
|
|
8
|
+
readonly tagMemberIndexes: Readonly<Record<string, number>>;
|
|
9
|
+
readonly memberTypes: readonly DuckDBType[];
|
|
10
|
+
constructor(memberTags: readonly string[], memberTypes: readonly DuckDBType[], alias?: string);
|
|
11
|
+
memberIndexForTag(tag: string): number;
|
|
12
|
+
memberTypeForTag(tag: string): DuckDBType;
|
|
13
|
+
get memberCount(): number;
|
|
14
|
+
toString(): string;
|
|
15
|
+
toLogicalType(): DuckDBLogicalType;
|
|
16
|
+
toJson(): Json;
|
|
17
|
+
}
|
|
18
|
+
export declare function UNION(members: Record<string, DuckDBType>, alias?: string): DuckDBUnionType;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DuckDBUnionType = void 0;
|
|
4
|
+
exports.UNION = UNION;
|
|
5
|
+
const BaseDuckDBType_1 = require("./BaseDuckDBType");
|
|
6
|
+
const DuckDBLogicalType_1 = require("../DuckDBLogicalType");
|
|
7
|
+
const DuckDBTypeId_1 = require("../DuckDBTypeId");
|
|
8
|
+
const sql_1 = require("../sql");
|
|
9
|
+
class DuckDBUnionType extends BaseDuckDBType_1.BaseDuckDBType {
|
|
10
|
+
memberTags;
|
|
11
|
+
tagMemberIndexes;
|
|
12
|
+
memberTypes;
|
|
13
|
+
constructor(memberTags, memberTypes, alias) {
|
|
14
|
+
super(DuckDBTypeId_1.DuckDBTypeId.UNION, alias);
|
|
15
|
+
if (memberTags.length !== memberTypes.length) {
|
|
16
|
+
throw new Error(`Could not create DuckDBUnionType: \
|
|
17
|
+
tags length (${memberTags.length}) does not match valueTypes length (${memberTypes.length})`);
|
|
18
|
+
}
|
|
19
|
+
this.memberTags = memberTags;
|
|
20
|
+
const tagMemberIndexes = {};
|
|
21
|
+
for (let i = 0; i < memberTags.length; i++) {
|
|
22
|
+
tagMemberIndexes[memberTags[i]] = i;
|
|
23
|
+
}
|
|
24
|
+
this.tagMemberIndexes = tagMemberIndexes;
|
|
25
|
+
this.memberTypes = memberTypes;
|
|
26
|
+
}
|
|
27
|
+
memberIndexForTag(tag) {
|
|
28
|
+
return this.tagMemberIndexes[tag];
|
|
29
|
+
}
|
|
30
|
+
memberTypeForTag(tag) {
|
|
31
|
+
return this.memberTypes[this.tagMemberIndexes[tag]];
|
|
32
|
+
}
|
|
33
|
+
get memberCount() {
|
|
34
|
+
return this.memberTags.length;
|
|
35
|
+
}
|
|
36
|
+
toString() {
|
|
37
|
+
const parts = [];
|
|
38
|
+
for (let i = 0; i < this.memberTags.length; i++) {
|
|
39
|
+
parts.push(`${(0, sql_1.quotedIdentifier)(this.memberTags[i])} ${this.memberTypes[i]}`);
|
|
40
|
+
}
|
|
41
|
+
return `UNION(${parts.join(', ')})`;
|
|
42
|
+
}
|
|
43
|
+
toLogicalType() {
|
|
44
|
+
const logicalType = DuckDBLogicalType_1.DuckDBLogicalType.createUnion(this.memberTags, this.memberTypes.map((t) => t.toLogicalType()));
|
|
45
|
+
if (this.alias) {
|
|
46
|
+
logicalType.alias = this.alias;
|
|
47
|
+
}
|
|
48
|
+
return logicalType;
|
|
49
|
+
}
|
|
50
|
+
toJson() {
|
|
51
|
+
return {
|
|
52
|
+
typeId: this.typeId,
|
|
53
|
+
memberTags: [...this.memberTags],
|
|
54
|
+
memberTypes: this.memberTypes.map(t => t.toJson()),
|
|
55
|
+
...(this.alias ? { alias: this.alias } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.DuckDBUnionType = DuckDBUnionType;
|
|
60
|
+
function UNION(members, alias) {
|
|
61
|
+
const memberTags = Object.keys(members);
|
|
62
|
+
const memberTypes = Object.values(members);
|
|
63
|
+
return new DuckDBUnionType(memberTags, memberTypes, alias);
|
|
64
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
export declare class DuckDBVarCharType extends BaseDuckDBType<DuckDBTypeId.VARCHAR> {
|
|
4
|
+
constructor(alias?: string);
|
|
5
|
+
static readonly instance: DuckDBVarCharType;
|
|
6
|
+
static create(alias?: string): DuckDBVarCharType;
|
|
7
|
+
}
|
|
8
|
+
export declare const VARCHAR: DuckDBVarCharType;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VARCHAR = exports.DuckDBVarCharType = void 0;
|
|
4
|
+
const BaseDuckDBType_1 = require("./BaseDuckDBType");
|
|
5
|
+
const DuckDBTypeId_1 = require("../DuckDBTypeId");
|
|
6
|
+
class DuckDBVarCharType extends BaseDuckDBType_1.BaseDuckDBType {
|
|
7
|
+
constructor(alias) {
|
|
8
|
+
super(DuckDBTypeId_1.DuckDBTypeId.VARCHAR, alias);
|
|
9
|
+
}
|
|
10
|
+
static instance = new DuckDBVarCharType();
|
|
11
|
+
static create(alias) {
|
|
12
|
+
return alias ? new DuckDBVarCharType(alias) : DuckDBVarCharType.instance;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.DuckDBVarCharType = DuckDBVarCharType;
|
|
16
|
+
exports.VARCHAR = DuckDBVarCharType.instance;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
export declare class DuckDBVariantType extends BaseDuckDBType<DuckDBTypeId.VARIANT> {
|
|
4
|
+
constructor(alias?: string);
|
|
5
|
+
static readonly instance: DuckDBVariantType;
|
|
6
|
+
static create(alias?: string): DuckDBVariantType;
|
|
7
|
+
}
|
|
8
|
+
export declare const VARIANT: DuckDBVariantType;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VARIANT = exports.DuckDBVariantType = void 0;
|
|
4
|
+
const BaseDuckDBType_1 = require("./BaseDuckDBType");
|
|
5
|
+
const DuckDBTypeId_1 = require("../DuckDBTypeId");
|
|
6
|
+
class DuckDBVariantType extends BaseDuckDBType_1.BaseDuckDBType {
|
|
7
|
+
constructor(alias) {
|
|
8
|
+
super(DuckDBTypeId_1.DuckDBTypeId.VARIANT, alias);
|
|
9
|
+
}
|
|
10
|
+
static instance = new DuckDBVariantType();
|
|
11
|
+
static create(alias) {
|
|
12
|
+
return alias ? new DuckDBVariantType(alias) : DuckDBVariantType.instance;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.DuckDBVariantType = DuckDBVariantType;
|
|
16
|
+
exports.VARIANT = DuckDBVariantType.instance;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export * from './BaseDuckDBType';
|
|
2
|
+
export * from './DuckDBAnyType';
|
|
3
|
+
export * from './DuckDBArrayType';
|
|
4
|
+
export * from './DuckDBBigIntType';
|
|
5
|
+
export * from './DuckDBBigNumType';
|
|
6
|
+
export * from './DuckDBBitType';
|
|
7
|
+
export * from './DuckDBBlobType';
|
|
8
|
+
export * from './DuckDBBooleanType';
|
|
9
|
+
export * from './DuckDBDateType';
|
|
10
|
+
export * from './DuckDBDecimalType';
|
|
11
|
+
export * from './DuckDBDoubleType';
|
|
12
|
+
export * from './DuckDBEnumType';
|
|
13
|
+
export * from './DuckDBFloatType';
|
|
14
|
+
export * from './DuckDBGeometryType';
|
|
15
|
+
export * from './DuckDBHugeIntType';
|
|
16
|
+
export * from './DuckDBIntegerLiteralType';
|
|
17
|
+
export * from './DuckDBIntegerType';
|
|
18
|
+
export * from './DuckDBIntervalType';
|
|
19
|
+
export * from './DuckDBListType';
|
|
20
|
+
export * from './DuckDBMapType';
|
|
21
|
+
export * from './DuckDBSQLNullType';
|
|
22
|
+
export * from './DuckDBSmallIntType';
|
|
23
|
+
export * from './DuckDBStringLiteralType';
|
|
24
|
+
export * from './DuckDBStructType';
|
|
25
|
+
export * from './DuckDBTimeNSType';
|
|
26
|
+
export * from './DuckDBTimeTZType';
|
|
27
|
+
export * from './DuckDBTimeType';
|
|
28
|
+
export * from './DuckDBTimestampMillisecondsType';
|
|
29
|
+
export * from './DuckDBTimestampNanosecondsType';
|
|
30
|
+
export * from './DuckDBTimestampSecondsType';
|
|
31
|
+
export * from './DuckDBTimestampTZType';
|
|
32
|
+
export * from './DuckDBTimestampTZNanosecondsType';
|
|
33
|
+
export * from './DuckDBTimestampType';
|
|
34
|
+
export * from './DuckDBTinyIntType';
|
|
35
|
+
export * from './DuckDBType';
|
|
36
|
+
export * from './DuckDBUBigIntType';
|
|
37
|
+
export * from './DuckDBUHugeIntType';
|
|
38
|
+
export * from './DuckDBUIntegerType';
|
|
39
|
+
export * from './DuckDBUSmallIntType';
|
|
40
|
+
export * from './DuckDBUTinyIntType';
|
|
41
|
+
export * from './DuckDBUUIDType';
|
|
42
|
+
export * from './DuckDBUnionType';
|
|
43
|
+
export * from './DuckDBVarCharType';
|
|
44
|
+
export * from './DuckDBVariantType';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./BaseDuckDBType"), exports);
|
|
18
|
+
__exportStar(require("./DuckDBAnyType"), exports);
|
|
19
|
+
__exportStar(require("./DuckDBArrayType"), exports);
|
|
20
|
+
__exportStar(require("./DuckDBBigIntType"), exports);
|
|
21
|
+
__exportStar(require("./DuckDBBigNumType"), exports);
|
|
22
|
+
__exportStar(require("./DuckDBBitType"), exports);
|
|
23
|
+
__exportStar(require("./DuckDBBlobType"), exports);
|
|
24
|
+
__exportStar(require("./DuckDBBooleanType"), exports);
|
|
25
|
+
__exportStar(require("./DuckDBDateType"), exports);
|
|
26
|
+
__exportStar(require("./DuckDBDecimalType"), exports);
|
|
27
|
+
__exportStar(require("./DuckDBDoubleType"), exports);
|
|
28
|
+
__exportStar(require("./DuckDBEnumType"), exports);
|
|
29
|
+
__exportStar(require("./DuckDBFloatType"), exports);
|
|
30
|
+
__exportStar(require("./DuckDBGeometryType"), exports);
|
|
31
|
+
__exportStar(require("./DuckDBHugeIntType"), exports);
|
|
32
|
+
__exportStar(require("./DuckDBIntegerLiteralType"), exports);
|
|
33
|
+
__exportStar(require("./DuckDBIntegerType"), exports);
|
|
34
|
+
__exportStar(require("./DuckDBIntervalType"), exports);
|
|
35
|
+
__exportStar(require("./DuckDBListType"), exports);
|
|
36
|
+
__exportStar(require("./DuckDBMapType"), exports);
|
|
37
|
+
__exportStar(require("./DuckDBSQLNullType"), exports);
|
|
38
|
+
__exportStar(require("./DuckDBSmallIntType"), exports);
|
|
39
|
+
__exportStar(require("./DuckDBStringLiteralType"), exports);
|
|
40
|
+
__exportStar(require("./DuckDBStructType"), exports);
|
|
41
|
+
__exportStar(require("./DuckDBTimeNSType"), exports);
|
|
42
|
+
__exportStar(require("./DuckDBTimeTZType"), exports);
|
|
43
|
+
__exportStar(require("./DuckDBTimeType"), exports);
|
|
44
|
+
__exportStar(require("./DuckDBTimestampMillisecondsType"), exports);
|
|
45
|
+
__exportStar(require("./DuckDBTimestampNanosecondsType"), exports);
|
|
46
|
+
__exportStar(require("./DuckDBTimestampSecondsType"), exports);
|
|
47
|
+
__exportStar(require("./DuckDBTimestampTZType"), exports);
|
|
48
|
+
__exportStar(require("./DuckDBTimestampTZNanosecondsType"), exports);
|
|
49
|
+
__exportStar(require("./DuckDBTimestampType"), exports);
|
|
50
|
+
__exportStar(require("./DuckDBTinyIntType"), exports);
|
|
51
|
+
__exportStar(require("./DuckDBType"), exports);
|
|
52
|
+
__exportStar(require("./DuckDBUBigIntType"), exports);
|
|
53
|
+
__exportStar(require("./DuckDBUHugeIntType"), exports);
|
|
54
|
+
__exportStar(require("./DuckDBUIntegerType"), exports);
|
|
55
|
+
__exportStar(require("./DuckDBUSmallIntType"), exports);
|
|
56
|
+
__exportStar(require("./DuckDBUTinyIntType"), exports);
|
|
57
|
+
__exportStar(require("./DuckDBUUIDType"), exports);
|
|
58
|
+
__exportStar(require("./DuckDBUnionType"), exports);
|
|
59
|
+
__exportStar(require("./DuckDBVarCharType"), exports);
|
|
60
|
+
__exportStar(require("./DuckDBVariantType"), exports);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class DuckDBGeometryValue {
|
|
2
|
+
/** In WKB. */
|
|
3
|
+
readonly bytes: Uint8Array;
|
|
4
|
+
/** Takes raw WKB. */
|
|
5
|
+
constructor(bytes: Uint8Array);
|
|
6
|
+
/** Returns WKB in string form matching DuckDB's BLOB-to-VARCHAR. */
|
|
7
|
+
toString(): string;
|
|
8
|
+
/** Takes WKB in string form matching DuckDB's BLOB-to-VARCHAR. */
|
|
9
|
+
static fromString(str: string): DuckDBGeometryValue;
|
|
10
|
+
}
|
|
11
|
+
/** Takes WKB, either raw or in string form matching DuckDB's BLOB-to-VARCHAR. */
|
|
12
|
+
export declare function geometryValue(input: Uint8Array | string): DuckDBGeometryValue;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DuckDBGeometryValue = void 0;
|
|
4
|
+
exports.geometryValue = geometryValue;
|
|
5
|
+
const bytesFromString_1 = require("../conversion/bytesFromString");
|
|
6
|
+
const stringFromBlob_1 = require("../conversion/stringFromBlob");
|
|
7
|
+
class DuckDBGeometryValue {
|
|
8
|
+
/** In WKB. */
|
|
9
|
+
bytes;
|
|
10
|
+
/** Takes raw WKB. */
|
|
11
|
+
constructor(bytes) {
|
|
12
|
+
this.bytes = bytes;
|
|
13
|
+
}
|
|
14
|
+
/** Returns WKB in string form matching DuckDB's BLOB-to-VARCHAR. */
|
|
15
|
+
toString() {
|
|
16
|
+
return (0, stringFromBlob_1.stringFromBlob)(this.bytes);
|
|
17
|
+
}
|
|
18
|
+
/** Takes WKB in string form matching DuckDB's BLOB-to-VARCHAR. */
|
|
19
|
+
static fromString(str) {
|
|
20
|
+
return new DuckDBGeometryValue(Buffer.from((0, bytesFromString_1.bytesFromString)(str)));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.DuckDBGeometryValue = DuckDBGeometryValue;
|
|
24
|
+
/** Takes WKB, either raw or in string form matching DuckDB's BLOB-to-VARCHAR. */
|
|
25
|
+
function geometryValue(input) {
|
|
26
|
+
if (typeof input === 'string') {
|
|
27
|
+
return DuckDBGeometryValue.fromString(input);
|
|
28
|
+
}
|
|
29
|
+
return new DuckDBGeometryValue(input);
|
|
30
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TimestampNanoseconds } from '@haybarn/node-bindings';
|
|
2
|
+
export declare class DuckDBTimestampTZNanosecondsValue implements TimestampNanoseconds {
|
|
3
|
+
readonly nanos: bigint;
|
|
4
|
+
constructor(nanos: bigint);
|
|
5
|
+
get isFinite(): boolean;
|
|
6
|
+
/** Formats in the time zone set by `DuckDBTimestampTZValue.timezoneOffsetInMinutes`. */
|
|
7
|
+
toString(): string;
|
|
8
|
+
static readonly Epoch: DuckDBTimestampTZNanosecondsValue;
|
|
9
|
+
static readonly Max: DuckDBTimestampTZNanosecondsValue;
|
|
10
|
+
static readonly Min: DuckDBTimestampTZNanosecondsValue;
|
|
11
|
+
static readonly PosInf: DuckDBTimestampTZNanosecondsValue;
|
|
12
|
+
static readonly NegInf: DuckDBTimestampTZNanosecondsValue;
|
|
13
|
+
}
|
|
14
|
+
export declare function timestampTZNanosValue(nanos: bigint): DuckDBTimestampTZNanosecondsValue;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBTimestampTZNanosecondsValue = void 0;
|
|
7
|
+
exports.timestampTZNanosValue = timestampTZNanosValue;
|
|
8
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
9
|
+
const dateTimeStringConversion_1 = require("../conversion/dateTimeStringConversion");
|
|
10
|
+
const DuckDBTimestampNanosecondsValue_1 = require("./DuckDBTimestampNanosecondsValue");
|
|
11
|
+
const DuckDBTimestampTZValue_1 = require("./DuckDBTimestampTZValue");
|
|
12
|
+
class DuckDBTimestampTZNanosecondsValue {
|
|
13
|
+
nanos;
|
|
14
|
+
constructor(nanos) {
|
|
15
|
+
this.nanos = nanos;
|
|
16
|
+
}
|
|
17
|
+
get isFinite() {
|
|
18
|
+
return node_bindings_1.default.is_finite_timestamp_ns(this);
|
|
19
|
+
}
|
|
20
|
+
/** Formats in the time zone set by `DuckDBTimestampTZValue.timezoneOffsetInMinutes`. */
|
|
21
|
+
toString() {
|
|
22
|
+
return (0, dateTimeStringConversion_1.getDuckDBTimestampStringFromNanoseconds)(this.nanos, DuckDBTimestampTZValue_1.DuckDBTimestampTZValue.timezoneOffsetInMinutes);
|
|
23
|
+
}
|
|
24
|
+
static Epoch = new DuckDBTimestampTZNanosecondsValue(0n);
|
|
25
|
+
static Max = new DuckDBTimestampTZNanosecondsValue(DuckDBTimestampNanosecondsValue_1.DuckDBTimestampNanosecondsValue.Max.nanos);
|
|
26
|
+
static Min = new DuckDBTimestampTZNanosecondsValue(DuckDBTimestampNanosecondsValue_1.DuckDBTimestampNanosecondsValue.Min.nanos);
|
|
27
|
+
static PosInf = new DuckDBTimestampTZNanosecondsValue(DuckDBTimestampNanosecondsValue_1.DuckDBTimestampNanosecondsValue.PosInf.nanos);
|
|
28
|
+
static NegInf = new DuckDBTimestampTZNanosecondsValue(DuckDBTimestampNanosecondsValue_1.DuckDBTimestampNanosecondsValue.NegInf.nanos);
|
|
29
|
+
}
|
|
30
|
+
exports.DuckDBTimestampTZNanosecondsValue = DuckDBTimestampTZNanosecondsValue;
|
|
31
|
+
function timestampTZNanosValue(nanos) {
|
|
32
|
+
return new DuckDBTimestampTZNanosecondsValue(nanos);
|
|
33
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DuckDBValue } from './DuckDBValue';
|
|
2
|
+
/**
|
|
3
|
+
* A value of a tuple type: an unnamed STRUCT, such as `(1, 'a')` or
|
|
4
|
+
* `row(1, 'a')`. Its items are in entry order.
|
|
5
|
+
*/
|
|
6
|
+
export declare class DuckDBTupleValue {
|
|
7
|
+
readonly items: readonly DuckDBValue[];
|
|
8
|
+
constructor(items: readonly DuckDBValue[]);
|
|
9
|
+
toString(): string;
|
|
10
|
+
}
|
|
11
|
+
export declare function tupleValue(items: readonly DuckDBValue[]): DuckDBTupleValue;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DuckDBTupleValue = void 0;
|
|
4
|
+
exports.tupleValue = tupleValue;
|
|
5
|
+
const displayStringForDuckDBValue_1 = require("../conversion/displayStringForDuckDBValue");
|
|
6
|
+
/**
|
|
7
|
+
* A value of a tuple type: an unnamed STRUCT, such as `(1, 'a')` or
|
|
8
|
+
* `row(1, 'a')`. Its items are in entry order.
|
|
9
|
+
*/
|
|
10
|
+
class DuckDBTupleValue {
|
|
11
|
+
items;
|
|
12
|
+
constructor(items) {
|
|
13
|
+
this.items = items;
|
|
14
|
+
}
|
|
15
|
+
toString() {
|
|
16
|
+
return `(${this.items.map(displayStringForDuckDBValue_1.displayStringForDuckDBValue).join(', ')})`;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.DuckDBTupleValue = DuckDBTupleValue;
|
|
20
|
+
function tupleValue(items) {
|
|
21
|
+
return new DuckDBTupleValue(items);
|
|
22
|
+
}
|
|
@@ -20,7 +20,11 @@ class DuckDBUUIDValue {
|
|
|
20
20
|
}
|
|
21
21
|
/** Create a DuckDBUUIDValue from an unsigned 128-bit integer in a JS BigInt. */
|
|
22
22
|
static fromUint128(uint128) {
|
|
23
|
-
|
|
23
|
+
// Convert the unsigned 128-bit input into DuckDB's storage form: MSB
|
|
24
|
+
// flipped (so numeric ordering matches string ordering) and held as a
|
|
25
|
+
// signed int128 (the same form `DuckDBUUIDVector` produces via
|
|
26
|
+
// `getInt128`).
|
|
27
|
+
return new DuckDBUUIDValue(BigInt.asIntN(128, uint128 ^ 0x80000000000000000000000000000000n));
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
26
30
|
* Create a DuckDBUUIDValue from a HUGEINT as stored by DuckDB.
|
|
@@ -3,6 +3,7 @@ import { DuckDBBitValue } from './DuckDBBitValue';
|
|
|
3
3
|
import { DuckDBBlobValue } from './DuckDBBlobValue';
|
|
4
4
|
import { DuckDBDateValue } from './DuckDBDateValue';
|
|
5
5
|
import { DuckDBDecimalValue } from './DuckDBDecimalValue';
|
|
6
|
+
import { DuckDBGeometryValue } from './DuckDBGeometryValue';
|
|
6
7
|
import { DuckDBIntervalValue } from './DuckDBIntervalValue';
|
|
7
8
|
import { DuckDBListValue } from './DuckDBListValue';
|
|
8
9
|
import { DuckDBMapValue } from './DuckDBMapValue';
|
|
@@ -12,9 +13,12 @@ import { DuckDBTimestampMillisecondsValue } from './DuckDBTimestampMillisecondsV
|
|
|
12
13
|
import { DuckDBTimestampNanosecondsValue } from './DuckDBTimestampNanosecondsValue';
|
|
13
14
|
import { DuckDBTimestampSecondsValue } from './DuckDBTimestampSecondsValue';
|
|
14
15
|
import { DuckDBTimestampTZValue } from './DuckDBTimestampTZValue';
|
|
16
|
+
import { DuckDBTimestampTZNanosecondsValue } from './DuckDBTimestampTZNanosecondsValue';
|
|
15
17
|
import { DuckDBTimestampValue } from './DuckDBTimestampValue';
|
|
16
18
|
import { DuckDBTimeTZValue } from './DuckDBTimeTZValue';
|
|
17
19
|
import { DuckDBTimeValue } from './DuckDBTimeValue';
|
|
20
|
+
import { DuckDBTupleValue } from './DuckDBTupleValue';
|
|
18
21
|
import { DuckDBUnionValue } from './DuckDBUnionValue';
|
|
19
22
|
import { DuckDBUUIDValue } from './DuckDBUUIDValue';
|
|
20
|
-
|
|
23
|
+
import { DuckDBVariantValue } from './DuckDBVariantValue';
|
|
24
|
+
export type DuckDBValue = null | boolean | number | bigint | string | DuckDBArrayValue | DuckDBBitValue | DuckDBBlobValue | DuckDBDateValue | DuckDBDecimalValue | DuckDBGeometryValue | DuckDBIntervalValue | DuckDBListValue | DuckDBMapValue | DuckDBStructValue | DuckDBTimestampMillisecondsValue | DuckDBTimestampNanosecondsValue | DuckDBTimestampSecondsValue | DuckDBTimestampTZValue | DuckDBTimestampTZNanosecondsValue | DuckDBTimestampValue | DuckDBTimeTZValue | DuckDBTimeValue | DuckDBTimeNSValue | DuckDBTupleValue | DuckDBUnionValue | DuckDBUUIDValue | DuckDBVariantValue;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DuckDBType } from '../DuckDBType';
|
|
2
|
+
import { DuckDBValue } from './DuckDBValue';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps a single decoded VARIANT row value. The wrapper distinguishes a
|
|
5
|
+
* SQL-NULL row (returned as bare `null`) from an embedded `VARIANT_NULL`
|
|
6
|
+
* tag (returned as `new DuckDBVariantValue(null)`).
|
|
7
|
+
*
|
|
8
|
+
* The optional `type` records the exact DuckDB type of the inner value
|
|
9
|
+
* (recovered from the on-disk variant tag at decode time). The append /
|
|
10
|
+
* bind paths use it so heterogeneous content round-trips faithfully —
|
|
11
|
+
* `typeForValue` is a best-effort fallback when `type` is not provided.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DuckDBVariantValue {
|
|
14
|
+
readonly value: DuckDBValue;
|
|
15
|
+
readonly type?: DuckDBType;
|
|
16
|
+
constructor(value: DuckDBValue, type?: DuckDBType);
|
|
17
|
+
toString(): string;
|
|
18
|
+
}
|
|
19
|
+
export declare function variantValue(value: DuckDBValue, type?: DuckDBType): DuckDBVariantValue;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DuckDBVariantValue = void 0;
|
|
4
|
+
exports.variantValue = variantValue;
|
|
5
|
+
const displayStringForDuckDBValue_1 = require("../conversion/displayStringForDuckDBValue");
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a single decoded VARIANT row value. The wrapper distinguishes a
|
|
8
|
+
* SQL-NULL row (returned as bare `null`) from an embedded `VARIANT_NULL`
|
|
9
|
+
* tag (returned as `new DuckDBVariantValue(null)`).
|
|
10
|
+
*
|
|
11
|
+
* The optional `type` records the exact DuckDB type of the inner value
|
|
12
|
+
* (recovered from the on-disk variant tag at decode time). The append /
|
|
13
|
+
* bind paths use it so heterogeneous content round-trips faithfully —
|
|
14
|
+
* `typeForValue` is a best-effort fallback when `type` is not provided.
|
|
15
|
+
*/
|
|
16
|
+
class DuckDBVariantValue {
|
|
17
|
+
value;
|
|
18
|
+
type;
|
|
19
|
+
constructor(value, type) {
|
|
20
|
+
this.value = value;
|
|
21
|
+
this.type = type;
|
|
22
|
+
}
|
|
23
|
+
toString() {
|
|
24
|
+
return (0, displayStringForDuckDBValue_1.displayStringForDuckDBValue)(this.value);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.DuckDBVariantValue = DuckDBVariantValue;
|
|
28
|
+
function variantValue(value, type) {
|
|
29
|
+
return new DuckDBVariantValue(value, type);
|
|
30
|
+
}
|
package/lib/values/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './DuckDBBitValue';
|
|
|
3
3
|
export * from './DuckDBBlobValue';
|
|
4
4
|
export * from './DuckDBDateValue';
|
|
5
5
|
export * from './DuckDBDecimalValue';
|
|
6
|
+
export * from './DuckDBGeometryValue';
|
|
6
7
|
export * from './DuckDBIntervalValue';
|
|
7
8
|
export * from './DuckDBListValue';
|
|
8
9
|
export * from './DuckDBMapValue';
|
|
@@ -12,9 +13,12 @@ export * from './DuckDBTimestampMillisecondsValue';
|
|
|
12
13
|
export * from './DuckDBTimestampNanosecondsValue';
|
|
13
14
|
export * from './DuckDBTimestampSecondsValue';
|
|
14
15
|
export * from './DuckDBTimestampTZValue';
|
|
16
|
+
export * from './DuckDBTimestampTZNanosecondsValue';
|
|
15
17
|
export * from './DuckDBTimestampValue';
|
|
16
18
|
export * from './DuckDBTimeTZValue';
|
|
17
19
|
export * from './DuckDBTimeValue';
|
|
20
|
+
export * from './DuckDBTupleValue';
|
|
18
21
|
export * from './DuckDBUnionValue';
|
|
19
22
|
export * from './DuckDBUUIDValue';
|
|
20
23
|
export * from './DuckDBValue';
|
|
24
|
+
export * from './DuckDBVariantValue';
|
package/lib/values/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./DuckDBBitValue"), exports);
|
|
|
19
19
|
__exportStar(require("./DuckDBBlobValue"), exports);
|
|
20
20
|
__exportStar(require("./DuckDBDateValue"), exports);
|
|
21
21
|
__exportStar(require("./DuckDBDecimalValue"), exports);
|
|
22
|
+
__exportStar(require("./DuckDBGeometryValue"), exports);
|
|
22
23
|
__exportStar(require("./DuckDBIntervalValue"), exports);
|
|
23
24
|
__exportStar(require("./DuckDBListValue"), exports);
|
|
24
25
|
__exportStar(require("./DuckDBMapValue"), exports);
|
|
@@ -28,9 +29,12 @@ __exportStar(require("./DuckDBTimestampMillisecondsValue"), exports);
|
|
|
28
29
|
__exportStar(require("./DuckDBTimestampNanosecondsValue"), exports);
|
|
29
30
|
__exportStar(require("./DuckDBTimestampSecondsValue"), exports);
|
|
30
31
|
__exportStar(require("./DuckDBTimestampTZValue"), exports);
|
|
32
|
+
__exportStar(require("./DuckDBTimestampTZNanosecondsValue"), exports);
|
|
31
33
|
__exportStar(require("./DuckDBTimestampValue"), exports);
|
|
32
34
|
__exportStar(require("./DuckDBTimeTZValue"), exports);
|
|
33
35
|
__exportStar(require("./DuckDBTimeValue"), exports);
|
|
36
|
+
__exportStar(require("./DuckDBTupleValue"), exports);
|
|
34
37
|
__exportStar(require("./DuckDBUnionValue"), exports);
|
|
35
38
|
__exportStar(require("./DuckDBUUIDValue"), exports);
|
|
36
39
|
__exportStar(require("./DuckDBValue"), exports);
|
|
40
|
+
__exportStar(require("./DuckDBVariantValue"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBArrayType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBArrayValue } from '../values';
|
|
4
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
5
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
6
|
+
export declare class DuckDBArrayVector extends DuckDBVector<DuckDBArrayValue> {
|
|
7
|
+
private readonly arrayType;
|
|
8
|
+
private readonly validity;
|
|
9
|
+
private readonly vector;
|
|
10
|
+
private readonly childData;
|
|
11
|
+
private readonly _itemCount;
|
|
12
|
+
constructor(arrayType: DuckDBArrayType, validity: DuckDBValidity, vector: duckdb.Vector, childData: DuckDBVector, itemCount: number);
|
|
13
|
+
static fromRawVector(arrayType: DuckDBArrayType, vector: duckdb.Vector, itemCount: number): DuckDBArrayVector;
|
|
14
|
+
private static itemSize;
|
|
15
|
+
get type(): DuckDBArrayType;
|
|
16
|
+
get itemCount(): number;
|
|
17
|
+
getItem(itemIndex: number): DuckDBArrayValue | null;
|
|
18
|
+
setItem(itemIndex: number, value: DuckDBArrayValue | null): void;
|
|
19
|
+
flush(): void;
|
|
20
|
+
slice(offset: number, length: number): DuckDBArrayVector;
|
|
21
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.DuckDBArrayVector = void 0;
|
|
7
|
+
const node_bindings_1 = __importDefault(require("@haybarn/node-bindings"));
|
|
8
|
+
const DuckDBType_1 = require("../DuckDBType");
|
|
9
|
+
const values_1 = require("../values");
|
|
10
|
+
const DuckDBVector_1 = require("./DuckDBVector");
|
|
11
|
+
const DuckDBValidity_1 = require("./DuckDBValidity");
|
|
12
|
+
class DuckDBArrayVector extends DuckDBVector_1.DuckDBVector {
|
|
13
|
+
arrayType;
|
|
14
|
+
validity;
|
|
15
|
+
vector;
|
|
16
|
+
childData;
|
|
17
|
+
_itemCount;
|
|
18
|
+
constructor(arrayType, validity, vector, childData, itemCount) {
|
|
19
|
+
super();
|
|
20
|
+
this.arrayType = arrayType;
|
|
21
|
+
this.validity = validity;
|
|
22
|
+
this.vector = vector;
|
|
23
|
+
this.childData = childData;
|
|
24
|
+
this._itemCount = itemCount;
|
|
25
|
+
}
|
|
26
|
+
static fromRawVector(arrayType, vector, itemCount) {
|
|
27
|
+
const validity = DuckDBValidity_1.DuckDBValidity.fromVector(vector, itemCount);
|
|
28
|
+
const child_vector = node_bindings_1.default.array_vector_get_child(vector);
|
|
29
|
+
const childItemsPerArray = DuckDBArrayVector.itemSize(arrayType) * arrayType.length;
|
|
30
|
+
const childData = DuckDBVector_1.DuckDBVector.create(child_vector, itemCount * childItemsPerArray, arrayType.valueType);
|
|
31
|
+
return new DuckDBArrayVector(arrayType, validity, vector, childData, itemCount);
|
|
32
|
+
}
|
|
33
|
+
static itemSize(arrayType) {
|
|
34
|
+
if (arrayType.valueType instanceof DuckDBType_1.DuckDBArrayType) {
|
|
35
|
+
return DuckDBArrayVector.itemSize(arrayType.valueType);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return 1;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
get type() {
|
|
42
|
+
return this.arrayType;
|
|
43
|
+
}
|
|
44
|
+
get itemCount() {
|
|
45
|
+
return this._itemCount;
|
|
46
|
+
}
|
|
47
|
+
getItem(itemIndex) {
|
|
48
|
+
if (!this.validity.itemValid(itemIndex)) {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
return new values_1.DuckDBArrayValue(this.childData
|
|
52
|
+
.slice(itemIndex * this.arrayType.length, this.arrayType.length)
|
|
53
|
+
.toArray());
|
|
54
|
+
}
|
|
55
|
+
setItem(itemIndex, value) {
|
|
56
|
+
if (value != null) {
|
|
57
|
+
const startIndex = itemIndex * this.arrayType.length;
|
|
58
|
+
for (let i = 0; i < this.arrayType.length; i++) {
|
|
59
|
+
this.childData.setItem(startIndex + i, value.items[i]);
|
|
60
|
+
}
|
|
61
|
+
this.validity.setItemValid(itemIndex, true);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const startIndex = itemIndex * this.arrayType.length;
|
|
65
|
+
for (let i = 0; i < this.arrayType.length; i++) {
|
|
66
|
+
this.childData.setItem(startIndex + i, null);
|
|
67
|
+
}
|
|
68
|
+
this.validity.setItemValid(itemIndex, false);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
flush() {
|
|
72
|
+
this.childData.flush();
|
|
73
|
+
this.validity.flush(this.vector);
|
|
74
|
+
}
|
|
75
|
+
slice(offset, length) {
|
|
76
|
+
return new DuckDBArrayVector(this.arrayType, this.validity.slice(offset, length), this.vector, this.childData.slice(offset * this.arrayType.length, length * this.arrayType.length), length);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.DuckDBArrayVector = DuckDBArrayVector;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import duckdb from '@haybarn/node-bindings';
|
|
2
|
+
import { DuckDBBigIntType } from '../DuckDBType';
|
|
3
|
+
import { DuckDBVector } from './DuckDBVector';
|
|
4
|
+
import { DuckDBValidity } from './DuckDBValidity';
|
|
5
|
+
export declare class DuckDBBigIntVector extends DuckDBVector<bigint> {
|
|
6
|
+
private readonly items;
|
|
7
|
+
private readonly validity;
|
|
8
|
+
private readonly vector;
|
|
9
|
+
constructor(items: BigInt64Array, validity: DuckDBValidity, vector: duckdb.Vector);
|
|
10
|
+
static fromRawVector(vector: duckdb.Vector, itemCount: number): DuckDBBigIntVector;
|
|
11
|
+
get type(): DuckDBBigIntType;
|
|
12
|
+
get itemCount(): number;
|
|
13
|
+
getItem(itemIndex: number): bigint | null;
|
|
14
|
+
setItem(itemIndex: number, value: bigint | null): void;
|
|
15
|
+
flush(): void;
|
|
16
|
+
slice(offset: number, length: number): DuckDBBigIntVector;
|
|
17
|
+
}
|