@leonardovida-md/drizzle-neo-duckdb 1.5.1 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/client.d.ts +1 -1
- package/dist/columns.d.ts +9 -2
- package/dist/driver.d.ts +2 -0
- package/dist/duckdb-introspect.mjs +481 -248
- package/dist/helpers.mjs +37 -9
- package/dist/index.mjs +522 -261
- package/dist/introspect.d.ts +1 -0
- package/dist/migration-config.d.ts +3 -0
- package/dist/migrator.d.ts +1 -2
- package/dist/options.d.ts +1 -0
- package/dist/select-builder.d.ts +4 -10
- package/dist/session.d.ts +15 -2
- package/dist/sql/selection.d.ts +11 -1
- package/package.json +17 -17
- package/src/bin/duckdb-introspect.ts +8 -4
- package/src/client.ts +287 -161
- package/src/columns.ts +73 -13
- package/src/dialect.ts +2 -3
- package/src/driver.ts +4 -0
- package/src/ducklake.ts +13 -2
- package/src/introspect.ts +108 -5
- package/src/migration-config.ts +9 -0
- package/src/migrator.ts +5 -6
- package/src/options.ts +20 -4
- package/src/pool.ts +54 -32
- package/src/select-builder.ts +6 -30
- package/src/session.ts +93 -43
- package/src/sql/result-mapper.ts +107 -52
- package/src/sql/selection.ts +49 -2
package/README.md
CHANGED
|
@@ -37,7 +37,8 @@ npm install @duckdbfan/drizzle-duckdb @duckdb/node-api
|
|
|
37
37
|
pnpm add @duckdbfan/drizzle-duckdb @duckdb/node-api
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
Supported client versions include `@duckdb/node-api@1.4.4-r.1` and `@duckdb/node-api@1.5.
|
|
40
|
+
Supported client versions include `@duckdb/node-api@1.4.4-r.1` and `@duckdb/node-api@1.5.2-r.1`. The repo now develops against `1.5.2-r.1`, and `1.4.4-r.1` remains supported.
|
|
41
|
+
Tested `drizzle-orm` versions currently span `0.40.1` through `0.45.x`.
|
|
41
42
|
|
|
42
43
|
## Quick Start
|
|
43
44
|
|
|
@@ -152,6 +153,7 @@ const db = drizzle(pool);
|
|
|
152
153
|
|
|
153
154
|
- Use `drizzle-orm/pg-core` for schemas; DuckDB SQL is largely Postgres-compatible.
|
|
154
155
|
- DuckDB-specific helpers: `duckDbList`, `duckDbArray`, `duckDbStruct`, `duckDbMap`, `duckDbJson`, `duckDbBlob`, `duckDbInet`, `duckDbInterval`, `duckDbTimestamp`, `duckDbDate`, `duckDbTime`.
|
|
156
|
+
- `duckDbTimestamp` and `duckDbTime` can preserve DuckDB-specific storage variants such as `TIMESTAMP_NS`, `TIMESTAMP_MS`, `TIMESTAMP_S`, `TIME_NS`, and `TIME WITH TIME ZONE` via the `duckDbType` / `withTimezone` options.
|
|
155
157
|
- Browser-safe imports live under `@duckdbfan/drizzle-duckdb/helpers` (introspection emits this path).
|
|
156
158
|
|
|
157
159
|
See the [column types](https://leonardovida.github.io/drizzle-duckdb/api/columns) docs for full API.
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DuckDBConnection, type DuckDBInstance } from '@duckdb/node-api';
|
|
2
|
-
import type
|
|
2
|
+
import { type PreparedStatementCacheConfig } from './options.ts';
|
|
3
3
|
export type DuckDBClientLike = DuckDBConnection | DuckDBConnectionPool;
|
|
4
4
|
export type RowData = Record<string, unknown>;
|
|
5
5
|
export interface DuckDBConnectionPool {
|
package/dist/columns.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ type FloatColType = 'FLOAT' | 'DOUBLE';
|
|
|
7
7
|
type StringColType = 'STRING' | 'VARCHAR' | 'TEXT';
|
|
8
8
|
type BoolColType = 'BOOLEAN' | 'BOOL';
|
|
9
9
|
type BlobColType = 'BLOB' | 'BYTEA' | 'VARBINARY';
|
|
10
|
-
type DateColType = 'DATE' | 'TIME' | 'TIMETZ' | 'TIMESTAMP' | 'DATETIME' | 'TIMESTAMPTZ' | 'TIMESTAMP_MS' | 'TIMESTAMP_S';
|
|
10
|
+
type DateColType = 'DATE' | 'TIME' | 'TIME_NS' | 'TIMETZ' | 'TIMESTAMP' | 'DATETIME' | 'TIMESTAMPTZ' | 'TIMESTAMP_MS' | 'TIMESTAMP_NS' | 'TIMESTAMP_S';
|
|
11
11
|
type AnyColType = IntColType | FloatColType | StringColType | BoolColType | DateColType | BlobColType;
|
|
12
12
|
type ListColType = `${AnyColType}[]`;
|
|
13
13
|
type ArrayColType = `${AnyColType}[${number}]`;
|
|
@@ -107,11 +107,18 @@ export declare const duckDbInterval: (name: string) => import("drizzle-orm/pg-co
|
|
|
107
107
|
enumValues: undefined;
|
|
108
108
|
}>;
|
|
109
109
|
type TimestampMode = 'date' | 'string';
|
|
110
|
+
type DuckDbTimestampType = 'TIMESTAMP' | 'TIMESTAMPTZ' | 'TIMESTAMP_S' | 'TIMESTAMP_MS' | 'TIMESTAMP_NS';
|
|
111
|
+
type DuckDbTimeType = 'TIME' | 'TIMETZ' | 'TIME_NS';
|
|
110
112
|
interface TimestampOptions {
|
|
111
113
|
withTimezone?: boolean;
|
|
112
114
|
mode?: TimestampMode;
|
|
113
115
|
precision?: number;
|
|
114
116
|
bindMode?: 'auto' | 'bind' | 'literal';
|
|
117
|
+
duckDbType?: DuckDbTimestampType;
|
|
118
|
+
}
|
|
119
|
+
interface TimeOptions {
|
|
120
|
+
withTimezone?: boolean;
|
|
121
|
+
duckDbType?: DuckDbTimeType;
|
|
115
122
|
}
|
|
116
123
|
export declare const duckDbTimestamp: (name: string, options?: TimestampOptions) => import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
117
124
|
name: string;
|
|
@@ -129,7 +136,7 @@ export declare const duckDbDate: (name: string) => import("drizzle-orm/pg-core")
|
|
|
129
136
|
driverParam: string | Date;
|
|
130
137
|
enumValues: undefined;
|
|
131
138
|
}>;
|
|
132
|
-
export declare const duckDbTime: (name: string) => import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
139
|
+
export declare const duckDbTime: (name: string, options?: TimeOptions) => import("drizzle-orm/pg-core").PgCustomColumnBuilder<{
|
|
133
140
|
name: string;
|
|
134
141
|
dataType: "custom";
|
|
135
142
|
columnType: "PgCustomColumn";
|
package/dist/driver.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { type DuckLakeConfig } from './ducklake.ts';
|
|
|
17
17
|
export interface PgDriverOptions {
|
|
18
18
|
logger?: Logger;
|
|
19
19
|
rejectStringArrayLiterals?: boolean;
|
|
20
|
+
arrayLiteralWarning?: (query: string) => void;
|
|
20
21
|
prepareCache?: PreparedStatementCacheConfig;
|
|
21
22
|
}
|
|
22
23
|
export declare class DuckDBDriver {
|
|
@@ -36,6 +37,7 @@ export interface DuckDBConnectionConfig {
|
|
|
36
37
|
}
|
|
37
38
|
export interface DuckDBDrizzleConfig<TSchema extends Record<string, unknown> = Record<string, never>> extends DrizzleConfig<TSchema> {
|
|
38
39
|
rejectStringArrayLiterals?: boolean;
|
|
40
|
+
arrayLiteralWarning?: (query: string) => void;
|
|
39
41
|
prepareCache?: PrepareCacheOption;
|
|
40
42
|
/** Pool configuration. Use preset name, size config, or false to disable. */
|
|
41
43
|
pool?: DuckDBPoolConfig | PoolPreset | false;
|