@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,104 @@
|
|
|
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
|
+
import { quotedIdentifier } from '../sql';
|
|
7
|
+
|
|
8
|
+
export class DuckDBStructType extends BaseDuckDBType<DuckDBTypeId.STRUCT> {
|
|
9
|
+
public readonly entryNames: readonly string[];
|
|
10
|
+
public readonly entryTypes: readonly DuckDBType[];
|
|
11
|
+
public readonly entryIndexes: Readonly<Record<string, number>>;
|
|
12
|
+
public constructor(
|
|
13
|
+
entryNames: readonly string[],
|
|
14
|
+
entryTypes: readonly DuckDBType[],
|
|
15
|
+
alias?: string
|
|
16
|
+
) {
|
|
17
|
+
super(DuckDBTypeId.STRUCT, alias);
|
|
18
|
+
if (entryNames.length !== entryTypes.length) {
|
|
19
|
+
throw new Error(`Could not create DuckDBStructType: \
|
|
20
|
+
entryNames length (${entryNames.length}) does not match entryTypes length (${entryTypes.length})`);
|
|
21
|
+
}
|
|
22
|
+
this.entryNames = entryNames;
|
|
23
|
+
this.entryTypes = entryTypes;
|
|
24
|
+
const entryIndexes: Record<string, number> = {};
|
|
25
|
+
for (let i = 0; i < entryNames.length; i++) {
|
|
26
|
+
entryIndexes[entryNames[i]] = i;
|
|
27
|
+
}
|
|
28
|
+
this.entryIndexes = entryIndexes;
|
|
29
|
+
}
|
|
30
|
+
public get entryCount() {
|
|
31
|
+
return this.entryNames.length;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Whether this is an unnamed struct, i.e. a tuple, such as the type of
|
|
35
|
+
* `(1, 'a')` or `row(1, 'a')`. DuckDB reports these as STRUCTs whose entry
|
|
36
|
+
* names are all empty. A STRUCT with no entries is not a tuple.
|
|
37
|
+
*
|
|
38
|
+
* Values of a tuple type are `DuckDBTupleValue`s, whose items are
|
|
39
|
+
* positional, rather than `DuckDBStructValue`s.
|
|
40
|
+
*/
|
|
41
|
+
public get isTuple(): boolean {
|
|
42
|
+
return (
|
|
43
|
+
this.entryNames.length > 0 && this.entryNames.every((name) => name === '')
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
public indexForEntry(entryName: string): number {
|
|
47
|
+
return this.entryIndexes[entryName];
|
|
48
|
+
}
|
|
49
|
+
public typeForEntry(entryName: string): DuckDBType {
|
|
50
|
+
return this.entryTypes[this.entryIndexes[entryName]];
|
|
51
|
+
}
|
|
52
|
+
public toString(): string {
|
|
53
|
+
if (this.entryNames.length === 0) {
|
|
54
|
+
return 'STRUCT';
|
|
55
|
+
}
|
|
56
|
+
if (this.isTuple) {
|
|
57
|
+
return `TUPLE(${this.entryTypes.join(', ')})`;
|
|
58
|
+
}
|
|
59
|
+
const parts: string[] = [];
|
|
60
|
+
for (let i = 0; i < this.entryNames.length; i++) {
|
|
61
|
+
parts.push(
|
|
62
|
+
`${quotedIdentifier(this.entryNames[i])} ${this.entryTypes[i]}`
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return `STRUCT(${parts.join(', ')})`;
|
|
66
|
+
}
|
|
67
|
+
public override toLogicalType(): DuckDBLogicalType {
|
|
68
|
+
const logicalType = DuckDBLogicalType.createStruct(
|
|
69
|
+
this.entryNames,
|
|
70
|
+
this.entryTypes.map((t) => t.toLogicalType())
|
|
71
|
+
);
|
|
72
|
+
if (this.alias) {
|
|
73
|
+
logicalType.alias = this.alias;
|
|
74
|
+
}
|
|
75
|
+
return logicalType;
|
|
76
|
+
}
|
|
77
|
+
public override toJson(): Json {
|
|
78
|
+
return {
|
|
79
|
+
typeId: this.typeId,
|
|
80
|
+
entryNames: [...this.entryNames],
|
|
81
|
+
entryTypes: this.entryTypes.map(t => t.toJson()),
|
|
82
|
+
...(this.alias ? { alias: this.alias } : {}),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
export function STRUCT(
|
|
87
|
+
entries: Record<string, DuckDBType>,
|
|
88
|
+
alias?: string
|
|
89
|
+
): DuckDBStructType {
|
|
90
|
+
const entryNames = Object.keys(entries);
|
|
91
|
+
const entryTypes = Object.values(entries);
|
|
92
|
+
return new DuckDBStructType(entryNames, entryTypes, alias);
|
|
93
|
+
}
|
|
94
|
+
/** Creates a tuple type: an unnamed STRUCT with the given entry types. */
|
|
95
|
+
export function TUPLE(
|
|
96
|
+
entryTypes: readonly DuckDBType[],
|
|
97
|
+
alias?: string
|
|
98
|
+
): DuckDBStructType {
|
|
99
|
+
return new DuckDBStructType(
|
|
100
|
+
entryTypes.map(() => ''),
|
|
101
|
+
entryTypes,
|
|
102
|
+
alias
|
|
103
|
+
);
|
|
104
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimeNSValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimeNSType extends BaseDuckDBType<DuckDBTypeId.TIME_NS> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIME_NS, alias);
|
|
8
|
+
}
|
|
9
|
+
public static readonly instance = new DuckDBTimeNSType();
|
|
10
|
+
public static create(alias?: string): DuckDBTimeNSType {
|
|
11
|
+
return alias ? new DuckDBTimeNSType(alias) : DuckDBTimeNSType.instance;
|
|
12
|
+
}
|
|
13
|
+
public get max() {
|
|
14
|
+
return DuckDBTimeNSValue.Max;
|
|
15
|
+
}
|
|
16
|
+
public get min() {
|
|
17
|
+
return DuckDBTimeNSValue.Min;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const TIME_NS = DuckDBTimeNSType.instance;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimeTZValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimeTZType extends BaseDuckDBType<DuckDBTypeId.TIME_TZ> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIME_TZ, alias);
|
|
8
|
+
}
|
|
9
|
+
public toString(): string {
|
|
10
|
+
return 'TIME WITH TIME ZONE';
|
|
11
|
+
}
|
|
12
|
+
public static readonly instance = new DuckDBTimeTZType();
|
|
13
|
+
public static create(alias?: string): DuckDBTimeTZType {
|
|
14
|
+
return alias ? new DuckDBTimeTZType(alias) : DuckDBTimeTZType.instance;
|
|
15
|
+
}
|
|
16
|
+
public get max() {
|
|
17
|
+
return DuckDBTimeTZValue.Max;
|
|
18
|
+
}
|
|
19
|
+
public get min() {
|
|
20
|
+
return DuckDBTimeTZValue.Min;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export const TIMETZ = DuckDBTimeTZType.instance;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimeValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimeType extends BaseDuckDBType<DuckDBTypeId.TIME> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIME, alias);
|
|
8
|
+
}
|
|
9
|
+
public static readonly instance = new DuckDBTimeType();
|
|
10
|
+
public static create(alias?: string): DuckDBTimeType {
|
|
11
|
+
return alias ? new DuckDBTimeType(alias) : DuckDBTimeType.instance;
|
|
12
|
+
}
|
|
13
|
+
public get max() {
|
|
14
|
+
return DuckDBTimeValue.Max;
|
|
15
|
+
}
|
|
16
|
+
public get min() {
|
|
17
|
+
return DuckDBTimeValue.Min;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const TIME = DuckDBTimeType.instance;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimestampMillisecondsValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimestampMillisecondsType extends BaseDuckDBType<DuckDBTypeId.TIMESTAMP_MS> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIMESTAMP_MS, alias);
|
|
8
|
+
}
|
|
9
|
+
public static readonly instance = new DuckDBTimestampMillisecondsType();
|
|
10
|
+
public static create(alias?: string): DuckDBTimestampMillisecondsType {
|
|
11
|
+
return alias ? new DuckDBTimestampMillisecondsType(alias) : DuckDBTimestampMillisecondsType.instance;
|
|
12
|
+
}
|
|
13
|
+
public get epoch() {
|
|
14
|
+
return DuckDBTimestampMillisecondsValue.Epoch;
|
|
15
|
+
}
|
|
16
|
+
public get max() {
|
|
17
|
+
return DuckDBTimestampMillisecondsValue.Max;
|
|
18
|
+
}
|
|
19
|
+
public get min() {
|
|
20
|
+
return DuckDBTimestampMillisecondsValue.Min;
|
|
21
|
+
}
|
|
22
|
+
public get posInf() {
|
|
23
|
+
return DuckDBTimestampMillisecondsValue.PosInf;
|
|
24
|
+
}
|
|
25
|
+
public get negInf() {
|
|
26
|
+
return DuckDBTimestampMillisecondsValue.NegInf;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export const TIMESTAMP_MS = DuckDBTimestampMillisecondsType.instance;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimestampNanosecondsValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimestampNanosecondsType extends BaseDuckDBType<DuckDBTypeId.TIMESTAMP_NS> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIMESTAMP_NS, alias);
|
|
8
|
+
}
|
|
9
|
+
public static readonly instance = new DuckDBTimestampNanosecondsType();
|
|
10
|
+
public static create(alias?: string): DuckDBTimestampNanosecondsType {
|
|
11
|
+
return alias ? new DuckDBTimestampNanosecondsType(alias) : DuckDBTimestampNanosecondsType.instance;
|
|
12
|
+
}
|
|
13
|
+
public get epoch() {
|
|
14
|
+
return DuckDBTimestampNanosecondsValue.Epoch;
|
|
15
|
+
}
|
|
16
|
+
public get max() {
|
|
17
|
+
return DuckDBTimestampNanosecondsValue.Max;
|
|
18
|
+
}
|
|
19
|
+
public get min() {
|
|
20
|
+
return DuckDBTimestampNanosecondsValue.Min;
|
|
21
|
+
}
|
|
22
|
+
public get posInf() {
|
|
23
|
+
return DuckDBTimestampNanosecondsValue.PosInf;
|
|
24
|
+
}
|
|
25
|
+
public get negInf() {
|
|
26
|
+
return DuckDBTimestampNanosecondsValue.NegInf;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export const TIMESTAMP_NS = DuckDBTimestampNanosecondsType.instance;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimestampSecondsValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimestampSecondsType extends BaseDuckDBType<DuckDBTypeId.TIMESTAMP_S> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIMESTAMP_S, alias);
|
|
8
|
+
}
|
|
9
|
+
public static readonly instance = new DuckDBTimestampSecondsType();
|
|
10
|
+
public static create(alias?: string): DuckDBTimestampSecondsType {
|
|
11
|
+
return alias ? new DuckDBTimestampSecondsType(alias) : DuckDBTimestampSecondsType.instance;
|
|
12
|
+
}
|
|
13
|
+
public get epoch() {
|
|
14
|
+
return DuckDBTimestampSecondsValue.Epoch;
|
|
15
|
+
}
|
|
16
|
+
public get max() {
|
|
17
|
+
return DuckDBTimestampSecondsValue.Max;
|
|
18
|
+
}
|
|
19
|
+
public get min() {
|
|
20
|
+
return DuckDBTimestampSecondsValue.Min;
|
|
21
|
+
}
|
|
22
|
+
public get posInf() {
|
|
23
|
+
return DuckDBTimestampSecondsValue.PosInf;
|
|
24
|
+
}
|
|
25
|
+
public get negInf() {
|
|
26
|
+
return DuckDBTimestampSecondsValue.NegInf;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export const TIMESTAMP_S = DuckDBTimestampSecondsType.instance;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimestampTZNanosecondsValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimestampTZNanosecondsType extends BaseDuckDBType<DuckDBTypeId.TIMESTAMP_TZ_NS> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIMESTAMP_TZ_NS, alias);
|
|
8
|
+
}
|
|
9
|
+
public toString(): string {
|
|
10
|
+
return 'TIMESTAMPTZ_NS';
|
|
11
|
+
}
|
|
12
|
+
public static readonly instance = new DuckDBTimestampTZNanosecondsType();
|
|
13
|
+
public static create(alias?: string): DuckDBTimestampTZNanosecondsType {
|
|
14
|
+
return alias ? new DuckDBTimestampTZNanosecondsType(alias) : DuckDBTimestampTZNanosecondsType.instance;
|
|
15
|
+
}
|
|
16
|
+
public get epoch() {
|
|
17
|
+
return DuckDBTimestampTZNanosecondsValue.Epoch;
|
|
18
|
+
}
|
|
19
|
+
public get max() {
|
|
20
|
+
return DuckDBTimestampTZNanosecondsValue.Max;
|
|
21
|
+
}
|
|
22
|
+
public get min() {
|
|
23
|
+
return DuckDBTimestampTZNanosecondsValue.Min;
|
|
24
|
+
}
|
|
25
|
+
public get posInf() {
|
|
26
|
+
return DuckDBTimestampTZNanosecondsValue.PosInf;
|
|
27
|
+
}
|
|
28
|
+
public get negInf() {
|
|
29
|
+
return DuckDBTimestampTZNanosecondsValue.NegInf;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export const TIMESTAMPTZ_NS = DuckDBTimestampTZNanosecondsType.instance;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimestampTZValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimestampTZType extends BaseDuckDBType<DuckDBTypeId.TIMESTAMP_TZ> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIMESTAMP_TZ, alias);
|
|
8
|
+
}
|
|
9
|
+
public toString(): string {
|
|
10
|
+
return 'TIMESTAMP WITH TIME ZONE';
|
|
11
|
+
}
|
|
12
|
+
public static readonly instance = new DuckDBTimestampTZType();
|
|
13
|
+
public static create(alias?: string): DuckDBTimestampTZType {
|
|
14
|
+
return alias ? new DuckDBTimestampTZType(alias) : DuckDBTimestampTZType.instance;
|
|
15
|
+
}
|
|
16
|
+
public get epoch() {
|
|
17
|
+
return DuckDBTimestampTZValue.Epoch;
|
|
18
|
+
}
|
|
19
|
+
public get max() {
|
|
20
|
+
return DuckDBTimestampTZValue.Max;
|
|
21
|
+
}
|
|
22
|
+
public get min() {
|
|
23
|
+
return DuckDBTimestampTZValue.Min;
|
|
24
|
+
}
|
|
25
|
+
public get posInf() {
|
|
26
|
+
return DuckDBTimestampTZValue.PosInf;
|
|
27
|
+
}
|
|
28
|
+
public get negInf() {
|
|
29
|
+
return DuckDBTimestampTZValue.NegInf;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export const TIMESTAMPTZ = DuckDBTimestampTZType.instance;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBTimestampValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBTimestampType extends BaseDuckDBType<DuckDBTypeId.TIMESTAMP> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.TIMESTAMP, alias);
|
|
8
|
+
}
|
|
9
|
+
public static readonly instance = new DuckDBTimestampType();
|
|
10
|
+
public static create(alias?: string): DuckDBTimestampType {
|
|
11
|
+
return alias ? new DuckDBTimestampType(alias) : DuckDBTimestampType.instance;
|
|
12
|
+
}
|
|
13
|
+
public get epoch() {
|
|
14
|
+
return DuckDBTimestampValue.Epoch;
|
|
15
|
+
}
|
|
16
|
+
public get max() {
|
|
17
|
+
return DuckDBTimestampValue.Max;
|
|
18
|
+
}
|
|
19
|
+
public get min() {
|
|
20
|
+
return DuckDBTimestampValue.Min;
|
|
21
|
+
}
|
|
22
|
+
public get posInf() {
|
|
23
|
+
return DuckDBTimestampValue.PosInf;
|
|
24
|
+
}
|
|
25
|
+
public get negInf() {
|
|
26
|
+
return DuckDBTimestampValue.NegInf;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export const TIMESTAMP = DuckDBTimestampType.instance;
|
|
30
|
+
|
|
31
|
+
export type DuckDBTimestampMicrosecondsType = DuckDBTimestampType;
|
|
32
|
+
export const DuckDBTimestampMicrosecondsType = DuckDBTimestampType;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
|
|
4
|
+
export class DuckDBTinyIntType extends BaseDuckDBType<DuckDBTypeId.TINYINT> {
|
|
5
|
+
public constructor(alias?: string) {
|
|
6
|
+
super(DuckDBTypeId.TINYINT, alias);
|
|
7
|
+
}
|
|
8
|
+
public static readonly instance = new DuckDBTinyIntType();
|
|
9
|
+
public static create(alias?: string): DuckDBTinyIntType {
|
|
10
|
+
return alias ? new DuckDBTinyIntType(alias) : DuckDBTinyIntType.instance;
|
|
11
|
+
}
|
|
12
|
+
public static readonly Max = 2 ** 7 - 1;
|
|
13
|
+
public static readonly Min = -(2 ** 7);
|
|
14
|
+
public get max() {
|
|
15
|
+
return DuckDBTinyIntType.Max;
|
|
16
|
+
}
|
|
17
|
+
public get min() {
|
|
18
|
+
return DuckDBTinyIntType.Min;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const TINYINT = DuckDBTinyIntType.instance;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { DuckDBAnyType } from './DuckDBAnyType';
|
|
2
|
+
import type { DuckDBArrayType } from './DuckDBArrayType';
|
|
3
|
+
import type { DuckDBBigIntType } from './DuckDBBigIntType';
|
|
4
|
+
import type { DuckDBBigNumType } from './DuckDBBigNumType';
|
|
5
|
+
import type { DuckDBBitType } from './DuckDBBitType';
|
|
6
|
+
import type { DuckDBBlobType } from './DuckDBBlobType';
|
|
7
|
+
import type { DuckDBBooleanType } from './DuckDBBooleanType';
|
|
8
|
+
import type { DuckDBDateType } from './DuckDBDateType';
|
|
9
|
+
import type { DuckDBDecimalType } from './DuckDBDecimalType';
|
|
10
|
+
import type { DuckDBDoubleType } from './DuckDBDoubleType';
|
|
11
|
+
import type { DuckDBEnumType } from './DuckDBEnumType';
|
|
12
|
+
import type { DuckDBFloatType } from './DuckDBFloatType';
|
|
13
|
+
import type { DuckDBGeometryType } from './DuckDBGeometryType';
|
|
14
|
+
import type { DuckDBHugeIntType } from './DuckDBHugeIntType';
|
|
15
|
+
import type { DuckDBIntegerLiteralType } from './DuckDBIntegerLiteralType';
|
|
16
|
+
import type { DuckDBIntegerType } from './DuckDBIntegerType';
|
|
17
|
+
import type { DuckDBIntervalType } from './DuckDBIntervalType';
|
|
18
|
+
import type { DuckDBListType } from './DuckDBListType';
|
|
19
|
+
import type { DuckDBMapType } from './DuckDBMapType';
|
|
20
|
+
import type { DuckDBSQLNullType } from './DuckDBSQLNullType';
|
|
21
|
+
import type { DuckDBSmallIntType } from './DuckDBSmallIntType';
|
|
22
|
+
import type { DuckDBStringLiteralType } from './DuckDBStringLiteralType';
|
|
23
|
+
import type { DuckDBStructType } from './DuckDBStructType';
|
|
24
|
+
import type { DuckDBTimeNSType } from './DuckDBTimeNSType';
|
|
25
|
+
import type { DuckDBTimeTZType } from './DuckDBTimeTZType';
|
|
26
|
+
import type { DuckDBTimeType } from './DuckDBTimeType';
|
|
27
|
+
import type { DuckDBTimestampMillisecondsType } from './DuckDBTimestampMillisecondsType';
|
|
28
|
+
import type { DuckDBTimestampNanosecondsType } from './DuckDBTimestampNanosecondsType';
|
|
29
|
+
import type { DuckDBTimestampSecondsType } from './DuckDBTimestampSecondsType';
|
|
30
|
+
import type { DuckDBTimestampTZType } from './DuckDBTimestampTZType';
|
|
31
|
+
import type { DuckDBTimestampTZNanosecondsType } from './DuckDBTimestampTZNanosecondsType';
|
|
32
|
+
import type { DuckDBTimestampType } from './DuckDBTimestampType';
|
|
33
|
+
import type { DuckDBTinyIntType } from './DuckDBTinyIntType';
|
|
34
|
+
import type { DuckDBUnionType } from './DuckDBUnionType';
|
|
35
|
+
import type { DuckDBUBigIntType } from './DuckDBUBigIntType';
|
|
36
|
+
import type { DuckDBUHugeIntType } from './DuckDBUHugeIntType';
|
|
37
|
+
import type { DuckDBUIntegerType } from './DuckDBUIntegerType';
|
|
38
|
+
import type { DuckDBUSmallIntType } from './DuckDBUSmallIntType';
|
|
39
|
+
import type { DuckDBUTinyIntType } from './DuckDBUTinyIntType';
|
|
40
|
+
import type { DuckDBUUIDType } from './DuckDBUUIDType';
|
|
41
|
+
import type { DuckDBVarCharType } from './DuckDBVarCharType';
|
|
42
|
+
import type { DuckDBVariantType } from './DuckDBVariantType';
|
|
43
|
+
|
|
44
|
+
export type DuckDBType =
|
|
45
|
+
| DuckDBBooleanType
|
|
46
|
+
| DuckDBTinyIntType
|
|
47
|
+
| DuckDBSmallIntType
|
|
48
|
+
| DuckDBIntegerType
|
|
49
|
+
| DuckDBBigIntType
|
|
50
|
+
| DuckDBUTinyIntType
|
|
51
|
+
| DuckDBUSmallIntType
|
|
52
|
+
| DuckDBUIntegerType
|
|
53
|
+
| DuckDBUBigIntType
|
|
54
|
+
| DuckDBFloatType
|
|
55
|
+
| DuckDBDoubleType
|
|
56
|
+
| DuckDBTimestampType
|
|
57
|
+
| DuckDBDateType
|
|
58
|
+
| DuckDBTimeType
|
|
59
|
+
| DuckDBIntervalType
|
|
60
|
+
| DuckDBHugeIntType
|
|
61
|
+
| DuckDBUHugeIntType
|
|
62
|
+
| DuckDBVarCharType
|
|
63
|
+
| DuckDBBlobType
|
|
64
|
+
| DuckDBDecimalType
|
|
65
|
+
| DuckDBTimestampSecondsType
|
|
66
|
+
| DuckDBTimestampMillisecondsType
|
|
67
|
+
| DuckDBTimestampNanosecondsType
|
|
68
|
+
| DuckDBEnumType
|
|
69
|
+
| DuckDBListType
|
|
70
|
+
| DuckDBStructType
|
|
71
|
+
| DuckDBMapType
|
|
72
|
+
| DuckDBArrayType
|
|
73
|
+
| DuckDBUUIDType
|
|
74
|
+
| DuckDBUnionType
|
|
75
|
+
| DuckDBBitType
|
|
76
|
+
| DuckDBTimeTZType
|
|
77
|
+
| DuckDBTimestampTZType
|
|
78
|
+
| DuckDBAnyType
|
|
79
|
+
| DuckDBBigNumType
|
|
80
|
+
| DuckDBSQLNullType
|
|
81
|
+
| DuckDBStringLiteralType
|
|
82
|
+
| DuckDBIntegerLiteralType
|
|
83
|
+
| DuckDBTimeNSType
|
|
84
|
+
| DuckDBGeometryType
|
|
85
|
+
| DuckDBVariantType
|
|
86
|
+
| DuckDBTimestampTZNanosecondsType;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
|
|
4
|
+
export class DuckDBUBigIntType extends BaseDuckDBType<DuckDBTypeId.UBIGINT> {
|
|
5
|
+
public constructor(alias?: string) {
|
|
6
|
+
super(DuckDBTypeId.UBIGINT, alias);
|
|
7
|
+
}
|
|
8
|
+
public static readonly instance = new DuckDBUBigIntType();
|
|
9
|
+
public static create(alias?: string): DuckDBUBigIntType {
|
|
10
|
+
return alias ? new DuckDBUBigIntType(alias) : DuckDBUBigIntType.instance;
|
|
11
|
+
}
|
|
12
|
+
public static readonly Max: bigint = 2n ** 64n - 1n;
|
|
13
|
+
public static readonly Min: bigint = 0n;
|
|
14
|
+
public get max() {
|
|
15
|
+
return DuckDBUBigIntType.Max;
|
|
16
|
+
}
|
|
17
|
+
public get min() {
|
|
18
|
+
return DuckDBUBigIntType.Min;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const UBIGINT = DuckDBUBigIntType.instance;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
|
|
4
|
+
export class DuckDBUHugeIntType extends BaseDuckDBType<DuckDBTypeId.UHUGEINT> {
|
|
5
|
+
public constructor(alias?: string) {
|
|
6
|
+
super(DuckDBTypeId.UHUGEINT, alias);
|
|
7
|
+
}
|
|
8
|
+
public static readonly instance = new DuckDBUHugeIntType();
|
|
9
|
+
public static create(alias?: string): DuckDBUHugeIntType {
|
|
10
|
+
return alias ? new DuckDBUHugeIntType(alias) : DuckDBUHugeIntType.instance;
|
|
11
|
+
}
|
|
12
|
+
public static readonly Max: bigint = 2n ** 128n - 1n;
|
|
13
|
+
public static readonly Min: bigint = 0n;
|
|
14
|
+
public get max() {
|
|
15
|
+
return DuckDBUHugeIntType.Max;
|
|
16
|
+
}
|
|
17
|
+
public get min() {
|
|
18
|
+
return DuckDBUHugeIntType.Min;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const UHUGEINT = DuckDBUHugeIntType.instance;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
|
|
4
|
+
export class DuckDBUIntegerType extends BaseDuckDBType<DuckDBTypeId.UINTEGER> {
|
|
5
|
+
public constructor(alias?: string) {
|
|
6
|
+
super(DuckDBTypeId.UINTEGER, alias);
|
|
7
|
+
}
|
|
8
|
+
public static readonly instance = new DuckDBUIntegerType();
|
|
9
|
+
public static create(alias?: string): DuckDBUIntegerType {
|
|
10
|
+
return alias ? new DuckDBUIntegerType(alias) : DuckDBUIntegerType.instance;
|
|
11
|
+
}
|
|
12
|
+
public static readonly Max = 2 ** 32 - 1;
|
|
13
|
+
public static readonly Min = 0;
|
|
14
|
+
public get max() {
|
|
15
|
+
return DuckDBUIntegerType.Max;
|
|
16
|
+
}
|
|
17
|
+
public get min() {
|
|
18
|
+
return DuckDBUIntegerType.Min;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const UINTEGER = DuckDBUIntegerType.instance;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
|
|
4
|
+
export class DuckDBUSmallIntType extends BaseDuckDBType<DuckDBTypeId.USMALLINT> {
|
|
5
|
+
public constructor(alias?: string) {
|
|
6
|
+
super(DuckDBTypeId.USMALLINT, alias);
|
|
7
|
+
}
|
|
8
|
+
public static readonly instance = new DuckDBUSmallIntType();
|
|
9
|
+
public static create(alias?: string): DuckDBUSmallIntType {
|
|
10
|
+
return alias ? new DuckDBUSmallIntType(alias) : DuckDBUSmallIntType.instance;
|
|
11
|
+
}
|
|
12
|
+
public static readonly Max = 2 ** 16 - 1;
|
|
13
|
+
public static readonly Min = 0;
|
|
14
|
+
public get max() {
|
|
15
|
+
return DuckDBUSmallIntType.Max;
|
|
16
|
+
}
|
|
17
|
+
public get min() {
|
|
18
|
+
return DuckDBUSmallIntType.Min;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const USMALLINT = DuckDBUSmallIntType.instance;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
|
|
4
|
+
export class DuckDBUTinyIntType extends BaseDuckDBType<DuckDBTypeId.UTINYINT> {
|
|
5
|
+
public constructor(alias?: string) {
|
|
6
|
+
super(DuckDBTypeId.UTINYINT, alias);
|
|
7
|
+
}
|
|
8
|
+
public static readonly instance = new DuckDBUTinyIntType();
|
|
9
|
+
public static create(alias?: string): DuckDBUTinyIntType {
|
|
10
|
+
return alias ? new DuckDBUTinyIntType(alias) : DuckDBUTinyIntType.instance;
|
|
11
|
+
}
|
|
12
|
+
public static readonly Max = 2 ** 8 - 1;
|
|
13
|
+
public static readonly Min = 0;
|
|
14
|
+
public get max() {
|
|
15
|
+
return DuckDBUTinyIntType.Max;
|
|
16
|
+
}
|
|
17
|
+
public get min() {
|
|
18
|
+
return DuckDBUTinyIntType.Min;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export const UTINYINT = DuckDBUTinyIntType.instance;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseDuckDBType } from './BaseDuckDBType';
|
|
2
|
+
import { DuckDBTypeId } from '../DuckDBTypeId';
|
|
3
|
+
import { DuckDBUUIDValue } from '../values';
|
|
4
|
+
|
|
5
|
+
export class DuckDBUUIDType extends BaseDuckDBType<DuckDBTypeId.UUID> {
|
|
6
|
+
public constructor(alias?: string) {
|
|
7
|
+
super(DuckDBTypeId.UUID, alias);
|
|
8
|
+
}
|
|
9
|
+
public static readonly instance = new DuckDBUUIDType();
|
|
10
|
+
public static create(alias?: string): DuckDBUUIDType {
|
|
11
|
+
return alias ? new DuckDBUUIDType(alias) : DuckDBUUIDType.instance;
|
|
12
|
+
}
|
|
13
|
+
public get max() {
|
|
14
|
+
return DuckDBUUIDValue.Max;
|
|
15
|
+
}
|
|
16
|
+
public get min() {
|
|
17
|
+
return DuckDBUUIDValue.Min;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export const UUID = DuckDBUUIDType.instance;
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
import { quotedIdentifier } from '../sql';
|
|
7
|
+
|
|
8
|
+
export class DuckDBUnionType extends BaseDuckDBType<DuckDBTypeId.UNION> {
|
|
9
|
+
public readonly memberTags: readonly string[];
|
|
10
|
+
public readonly tagMemberIndexes: Readonly<Record<string, number>>;
|
|
11
|
+
public readonly memberTypes: readonly DuckDBType[];
|
|
12
|
+
public constructor(
|
|
13
|
+
memberTags: readonly string[],
|
|
14
|
+
memberTypes: readonly DuckDBType[],
|
|
15
|
+
alias?: string
|
|
16
|
+
) {
|
|
17
|
+
super(DuckDBTypeId.UNION, alias);
|
|
18
|
+
if (memberTags.length !== memberTypes.length) {
|
|
19
|
+
throw new Error(`Could not create DuckDBUnionType: \
|
|
20
|
+
tags length (${memberTags.length}) does not match valueTypes length (${memberTypes.length})`);
|
|
21
|
+
}
|
|
22
|
+
this.memberTags = memberTags;
|
|
23
|
+
const tagMemberIndexes: Record<string, number> = {};
|
|
24
|
+
for (let i = 0; i < memberTags.length; i++) {
|
|
25
|
+
tagMemberIndexes[memberTags[i]] = i;
|
|
26
|
+
}
|
|
27
|
+
this.tagMemberIndexes = tagMemberIndexes;
|
|
28
|
+
this.memberTypes = memberTypes;
|
|
29
|
+
}
|
|
30
|
+
public memberIndexForTag(tag: string): number {
|
|
31
|
+
return this.tagMemberIndexes[tag];
|
|
32
|
+
}
|
|
33
|
+
public memberTypeForTag(tag: string): DuckDBType {
|
|
34
|
+
return this.memberTypes[this.tagMemberIndexes[tag]];
|
|
35
|
+
}
|
|
36
|
+
public get memberCount() {
|
|
37
|
+
return this.memberTags.length;
|
|
38
|
+
}
|
|
39
|
+
public toString(): string {
|
|
40
|
+
const parts: string[] = [];
|
|
41
|
+
for (let i = 0; i < this.memberTags.length; i++) {
|
|
42
|
+
parts.push(
|
|
43
|
+
`${quotedIdentifier(this.memberTags[i])} ${this.memberTypes[i]}`
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
return `UNION(${parts.join(', ')})`;
|
|
47
|
+
}
|
|
48
|
+
public override toLogicalType(): DuckDBLogicalType {
|
|
49
|
+
const logicalType = DuckDBLogicalType.createUnion(
|
|
50
|
+
this.memberTags,
|
|
51
|
+
this.memberTypes.map((t) => t.toLogicalType())
|
|
52
|
+
);
|
|
53
|
+
if (this.alias) {
|
|
54
|
+
logicalType.alias = this.alias;
|
|
55
|
+
}
|
|
56
|
+
return logicalType;
|
|
57
|
+
}
|
|
58
|
+
public override toJson(): Json {
|
|
59
|
+
return {
|
|
60
|
+
typeId: this.typeId,
|
|
61
|
+
memberTags: [...this.memberTags],
|
|
62
|
+
memberTypes: this.memberTypes.map(t => t.toJson()),
|
|
63
|
+
...(this.alias ? { alias: this.alias } : {}),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function UNION(
|
|
68
|
+
members: Record<string, DuckDBType>,
|
|
69
|
+
alias?: string
|
|
70
|
+
): DuckDBUnionType {
|
|
71
|
+
const memberTags = Object.keys(members);
|
|
72
|
+
const memberTypes = Object.values(members);
|
|
73
|
+
return new DuckDBUnionType(memberTags, memberTypes, alias);
|
|
74
|
+
}
|