@leonardovida-md/drizzle-neo-duckdb 1.1.4 → 1.2.1
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 +2 -3
- package/dist/dialect.d.ts +3 -1
- package/dist/driver.d.ts +1 -3
- package/dist/duckdb-introspect.mjs +552 -837
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +560 -832
- package/dist/operators.d.ts +8 -0
- package/dist/options.d.ts +0 -3
- package/dist/session.d.ts +2 -5
- package/dist/sql/ast-transformer.d.ts +31 -0
- package/dist/sql/visitors/array-operators.d.ts +5 -0
- package/dist/sql/visitors/column-qualifier.d.ts +10 -0
- package/dist/utils.d.ts +0 -1
- package/package.json +4 -3
- package/src/dialect.ts +20 -0
- package/src/driver.ts +0 -8
- package/src/index.ts +1 -0
- package/src/operators.ts +27 -0
- package/src/options.ts +0 -15
- package/src/session.ts +10 -96
- package/src/sql/ast-transformer.ts +144 -0
- package/src/sql/visitors/array-operators.ts +214 -0
- package/src/sql/visitors/column-qualifier.ts +565 -0
- package/src/utils.ts +0 -1
- package/dist/sql/query-rewriters.d.ts +0 -15
- package/src/sql/query-rewriters.ts +0 -1161
package/README.md
CHANGED
|
@@ -280,9 +280,6 @@ const db = drizzle(connection, {
|
|
|
280
280
|
// Pool size/preset when using connection strings (default: 4). Set false to disable.
|
|
281
281
|
pool: { size: 8 },
|
|
282
282
|
|
|
283
|
-
// Rewrite Postgres array operators to DuckDB functions (default: true)
|
|
284
|
-
rewriteArrays: true,
|
|
285
|
-
|
|
286
283
|
// Throw on Postgres-style array literals like '{1,2,3}' (default: false)
|
|
287
284
|
rejectStringArrayLiterals: false,
|
|
288
285
|
|
|
@@ -291,6 +288,8 @@ const db = drizzle(connection, {
|
|
|
291
288
|
});
|
|
292
289
|
```
|
|
293
290
|
|
|
291
|
+
Postgres array operators (`@>`, `<@`, `&&`) are automatically rewritten to DuckDB's `array_has_*` functions via AST transformation.
|
|
292
|
+
|
|
294
293
|
## Known Limitations
|
|
295
294
|
|
|
296
295
|
This connector aims for compatibility with Drizzle's Postgres driver but has some differences:
|
package/dist/dialect.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { entityKind } from 'drizzle-orm/entity';
|
|
2
2
|
import type { MigrationConfig, MigrationMeta } from 'drizzle-orm/migrator';
|
|
3
3
|
import { PgDialect, PgSession } from 'drizzle-orm/pg-core';
|
|
4
|
-
import { type DriverValueEncoder, type QueryTypingsValue } from 'drizzle-orm';
|
|
4
|
+
import { SQL, type DriverValueEncoder, type QueryTypingsValue } from 'drizzle-orm';
|
|
5
|
+
import type { QueryWithTypings } from 'drizzle-orm/sql/sql';
|
|
5
6
|
export declare class DuckDBDialect extends PgDialect {
|
|
6
7
|
static readonly [entityKind]: string;
|
|
7
8
|
private hasPgJsonColumn;
|
|
@@ -29,4 +30,5 @@ export declare class DuckDBDialect extends PgDialect {
|
|
|
29
30
|
markSavepointsUnsupported(): void;
|
|
30
31
|
migrate(migrations: MigrationMeta[], session: PgSession, config: MigrationConfig | string): Promise<void>;
|
|
31
32
|
prepareTyping(encoder: DriverValueEncoder<unknown, unknown>): QueryTypingsValue;
|
|
33
|
+
sqlToQuery(sqlObj: SQL, invokeSource?: 'indexes' | undefined): QueryWithTypings;
|
|
32
34
|
}
|
package/dist/driver.d.ts
CHANGED
|
@@ -12,10 +12,9 @@ import { DuckDBDialect } from './dialect.ts';
|
|
|
12
12
|
import { DuckDBSelectBuilder } from './select-builder.ts';
|
|
13
13
|
import type { ExecuteBatchesRawChunk, ExecuteInBatchesOptions, RowData } from './client.ts';
|
|
14
14
|
import { type DuckDBPoolConfig, type PoolPreset } from './pool.ts';
|
|
15
|
-
import { type PreparedStatementCacheConfig, type PrepareCacheOption
|
|
15
|
+
import { type PreparedStatementCacheConfig, type PrepareCacheOption } from './options.ts';
|
|
16
16
|
export interface PgDriverOptions {
|
|
17
17
|
logger?: Logger;
|
|
18
|
-
rewriteArrays?: RewriteArraysMode;
|
|
19
18
|
rejectStringArrayLiterals?: boolean;
|
|
20
19
|
prepareCache?: PreparedStatementCacheConfig;
|
|
21
20
|
}
|
|
@@ -35,7 +34,6 @@ export interface DuckDBConnectionConfig {
|
|
|
35
34
|
options?: Record<string, string>;
|
|
36
35
|
}
|
|
37
36
|
export interface DuckDBDrizzleConfig<TSchema extends Record<string, unknown> = Record<string, never>> extends DrizzleConfig<TSchema> {
|
|
38
|
-
rewriteArrays?: RewriteArraysOption;
|
|
39
37
|
rejectStringArrayLiterals?: boolean;
|
|
40
38
|
prepareCache?: PrepareCacheOption;
|
|
41
39
|
/** Pool configuration. Use preset name, size config, or false to disable. */
|