drizzle-orm 0.25.2 → 0.25.3-4cc2d87
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/aws-data-api/pg/index.cjs +234 -1
- package/aws-data-api/pg/index.cjs.map +1 -1
- package/aws-data-api/pg/index.d.ts +5 -6
- package/aws-data-api/pg/index.mjs +228 -1
- package/aws-data-api/pg/index.mjs.map +1 -1
- package/aws-data-api/pg/migrator.cjs +13 -1
- package/aws-data-api/pg/migrator.cjs.map +1 -1
- package/aws-data-api/pg/migrator.d.ts +5 -6
- package/aws-data-api/pg/migrator.mjs +11 -1
- package/aws-data-api/pg/migrator.mjs.map +1 -1
- package/better-sqlite3/index.cjs +119 -1
- package/better-sqlite3/index.cjs.map +1 -1
- package/better-sqlite3/index.d.ts +14 -12
- package/better-sqlite3/index.mjs +114 -1
- package/better-sqlite3/index.mjs.map +1 -1
- package/better-sqlite3/migrator.cjs +13 -1
- package/better-sqlite3/migrator.cjs.map +1 -1
- package/better-sqlite3/migrator.d.ts +5 -5
- package/better-sqlite3/migrator.mjs +11 -1
- package/better-sqlite3/migrator.mjs.map +1 -1
- package/bun-sqlite/index.cjs +126 -1
- package/bun-sqlite/index.cjs.map +1 -1
- package/bun-sqlite/index.d.ts +14 -12
- package/bun-sqlite/index.mjs +121 -1
- package/bun-sqlite/index.mjs.map +1 -1
- package/bun-sqlite/migrator.cjs +13 -1
- package/bun-sqlite/migrator.cjs.map +1 -1
- package/bun-sqlite/migrator.d.ts +5 -5
- package/bun-sqlite/migrator.mjs +11 -1
- package/bun-sqlite/migrator.mjs.map +1 -1
- package/{column.d-8b137277.d.ts → column.d-c31e7ad3.d.ts} +77 -6
- package/d1/index.cjs +116 -1
- package/d1/index.cjs.map +1 -1
- package/d1/index.d.ts +15 -12
- package/d1/index.mjs +111 -1
- package/d1/index.mjs.map +1 -1
- package/d1/migrator.cjs +13 -1
- package/d1/migrator.cjs.map +1 -1
- package/d1/migrator.d.ts +5 -5
- package/d1/migrator.mjs +11 -1
- package/d1/migrator.mjs.map +1 -1
- package/{db.d-ae495c35.d.ts → db.d-a2311092.d.ts} +121 -44
- package/{db.d-66553b9e.d.ts → db.d-bc9a1d6c.d.ts} +193 -16
- package/driver.d-17ca4c15.d.ts +8 -0
- package/driver.d-300ddb0e.d.ts +64 -0
- package/driver.d-45e56643.d.ts +60 -0
- package/driver.d-64f2125c.d.ts +8 -0
- package/driver.d-7fde2e9d.d.ts +55 -0
- package/driver.d-9d703b84.d.ts +8 -0
- package/driver.d-b2b94bf9.d.ts +46 -0
- package/driver.d-b70ee7ee.d.ts +55 -0
- package/driver.d-dea23ee6.d.ts +8 -0
- package/driver.d-e54af17b.d.ts +52 -0
- package/driver.d-eb490c91.d.ts +9 -0
- package/driver.d-ef6fa2df.d.ts +14 -0
- package/errors-bb636d84.mjs +19 -0
- package/errors-bb636d84.mjs.map +1 -0
- package/errors-d0192d62.cjs +22 -0
- package/errors-d0192d62.cjs.map +1 -0
- package/index.cjs +105 -1
- package/index.cjs.map +1 -1
- package/index.d.ts +16 -432
- package/index.mjs +3 -1
- package/index.mjs.map +1 -1
- package/knex/index.cjs +2 -1
- package/knex/index.cjs.map +1 -1
- package/knex/index.d.ts +1 -1
- package/kysely/index.cjs +2 -1
- package/kysely/index.cjs.map +1 -1
- package/kysely/index.d.ts +1 -1
- package/libsql/index.cjs +155 -1
- package/libsql/index.cjs.map +1 -1
- package/libsql/index.d.ts +14 -12
- package/libsql/index.mjs +150 -1
- package/libsql/index.mjs.map +1 -1
- package/libsql/migrator.cjs +13 -1
- package/libsql/migrator.cjs.map +1 -1
- package/libsql/migrator.d.ts +5 -5
- package/libsql/migrator.mjs +11 -1
- package/libsql/migrator.mjs.map +1 -1
- package/logger-caa1ca6e.cjs +34 -0
- package/logger-caa1ca6e.cjs.map +1 -0
- package/logger-caf75bde.mjs +30 -0
- package/logger-caf75bde.mjs.map +1 -0
- package/migrator.cjs +48 -1
- package/migrator.cjs.map +1 -1
- package/migrator.mjs +46 -1
- package/migrator.mjs.map +1 -1
- package/mysql-core/index.cjs +1004 -1
- package/mysql-core/index.cjs.map +1 -1
- package/mysql-core/index.d.ts +347 -347
- package/mysql-core/index.mjs +869 -1
- package/mysql-core/index.mjs.map +1 -1
- package/mysql2/index.cjs +230 -1
- package/mysql2/index.cjs.map +1 -1
- package/mysql2/index.d.ts +5 -6
- package/mysql2/index.mjs +223 -1
- package/mysql2/index.mjs.map +1 -1
- package/mysql2/migrator.cjs +13 -1
- package/mysql2/migrator.cjs.map +1 -1
- package/mysql2/migrator.d.ts +5 -6
- package/mysql2/migrator.mjs +11 -1
- package/mysql2/migrator.mjs.map +1 -1
- package/neon-serverless/index.cjs +155 -1
- package/neon-serverless/index.cjs.map +1 -1
- package/neon-serverless/index.d.ts +5 -6
- package/neon-serverless/index.mjs +149 -1
- package/neon-serverless/index.mjs.map +1 -1
- package/neon-serverless/migrator.cjs +13 -1
- package/neon-serverless/migrator.cjs.map +1 -1
- package/neon-serverless/migrator.d.ts +5 -6
- package/neon-serverless/migrator.mjs +11 -1
- package/neon-serverless/migrator.mjs.map +1 -1
- package/node-postgres/index.cjs +157 -1
- package/node-postgres/index.cjs.map +1 -1
- package/node-postgres/index.d.ts +5 -6
- package/node-postgres/index.mjs +151 -1
- package/node-postgres/index.mjs.map +1 -1
- package/node-postgres/migrator.cjs +13 -1
- package/node-postgres/migrator.cjs.map +1 -1
- package/node-postgres/migrator.d.ts +5 -6
- package/node-postgres/migrator.mjs +11 -1
- package/node-postgres/migrator.mjs.map +1 -1
- package/package.json +97 -34
- package/pg-core/index.cjs +652 -1
- package/pg-core/index.cjs.map +1 -1
- package/pg-core/index.d.ts +13 -7
- package/pg-core/index.mjs +501 -1
- package/pg-core/index.mjs.map +1 -1
- package/planetscale-serverless/index.cjs +111 -1
- package/planetscale-serverless/index.cjs.map +1 -1
- package/planetscale-serverless/index.d.ts +5 -6
- package/planetscale-serverless/index.mjs +106 -1
- package/planetscale-serverless/index.mjs.map +1 -1
- package/planetscale-serverless/migrator.cjs +13 -1
- package/planetscale-serverless/migrator.cjs.map +1 -1
- package/planetscale-serverless/migrator.d.ts +5 -6
- package/planetscale-serverless/migrator.mjs +11 -1
- package/planetscale-serverless/migrator.mjs.map +1 -1
- package/postgres-js/index.cjs +113 -1
- package/postgres-js/index.cjs.map +1 -1
- package/postgres-js/index.d.ts +5 -6
- package/postgres-js/index.mjs +108 -1
- package/postgres-js/index.mjs.map +1 -1
- package/postgres-js/migrator.cjs +13 -1
- package/postgres-js/migrator.cjs.map +1 -1
- package/postgres-js/migrator.d.ts +5 -6
- package/postgres-js/migrator.mjs +11 -1
- package/postgres-js/migrator.mjs.map +1 -1
- package/query-promise.d-e370e0a9.d.ts +617 -0
- package/relations-47eb5c5f.mjs +2954 -0
- package/relations-47eb5c5f.mjs.map +1 -0
- package/relations-5e2d30dd.cjs +3117 -0
- package/relations-5e2d30dd.cjs.map +1 -0
- package/{select.types.d-c3e86d45.d.ts → select.types.d-34d7f74e.d.ts} +1 -1
- package/{select.types.d-adb82002.d.ts → select.types.d-ae2f8e44.d.ts} +58 -14
- package/session-483ed08d.mjs +1263 -0
- package/session-483ed08d.mjs.map +1 -0
- package/session-6bd76405.cjs +362 -0
- package/session-6bd76405.cjs.map +1 -0
- package/session-a90df8a2.cjs +1252 -0
- package/session-a90df8a2.cjs.map +1 -0
- package/session-b99382a2.mjs +1223 -0
- package/session-b99382a2.mjs.map +1 -0
- package/session-c62f6348.cjs +1298 -0
- package/session-c62f6348.cjs.map +1 -0
- package/session-e8745392.mjs +351 -0
- package/session-e8745392.mjs.map +1 -0
- package/sql-js/index.cjs +175 -1
- package/sql-js/index.cjs.map +1 -1
- package/sql-js/index.d.ts +14 -12
- package/sql-js/index.mjs +170 -1
- package/sql-js/index.mjs.map +1 -1
- package/sql-js/migrator.cjs +13 -1
- package/sql-js/migrator.cjs.map +1 -1
- package/sql-js/migrator.d.ts +5 -5
- package/sql-js/migrator.mjs +11 -1
- package/sql-js/migrator.mjs.map +1 -1
- package/sqlite-core/index.cjs +516 -1
- package/sqlite-core/index.cjs.map +1 -1
- package/sqlite-core/index.d.ts +6 -5
- package/sqlite-core/index.mjs +441 -1
- package/sqlite-core/index.mjs.map +1 -1
- package/sqlite-proxy/index.cjs +118 -1
- package/sqlite-proxy/index.cjs.map +1 -1
- package/sqlite-proxy/index.d.ts +12 -11
- package/sqlite-proxy/index.mjs +113 -1
- package/sqlite-proxy/index.mjs.map +1 -1
- package/sqlite-proxy/migrator.cjs +25 -2
- package/sqlite-proxy/migrator.cjs.map +1 -1
- package/sqlite-proxy/migrator.d.ts +5 -5
- package/sqlite-proxy/migrator.mjs +23 -2
- package/sqlite-proxy/migrator.mjs.map +1 -1
- package/version.cjs +9 -1
- package/version.cjs.map +1 -1
- package/version.d.ts +1 -1
- package/version.mjs +6 -1
- package/version.mjs.map +1 -1
- package/README.md +0 -150
- package/column-builder-592f0191.mjs +0 -2
- package/column-builder-592f0191.mjs.map +0 -1
- package/column-builder-b48639f3.cjs +0 -2
- package/column-builder-b48639f3.cjs.map +0 -1
- package/driver.d-0158cd93.d.ts +0 -11
- package/driver.d-1f73a4a9.d.ts +0 -70
- package/driver.d-2e907d12.d.ts +0 -17
- package/driver.d-3781598a.d.ts +0 -11
- package/driver.d-3a8adf2a.d.ts +0 -61
- package/driver.d-59580d08.d.ts +0 -11
- package/driver.d-5f3fc125.d.ts +0 -12
- package/driver.d-693f7f9f.d.ts +0 -56
- package/driver.d-6c43e393.d.ts +0 -60
- package/driver.d-b00fc6ec.d.ts +0 -57
- package/driver.d-e4bd120b.d.ts +0 -47
- package/driver.d-f4b5b390.d.ts +0 -11
- package/index-59b7992d.cjs +0 -2
- package/index-59b7992d.cjs.map +0 -1
- package/index-b71998f1.mjs +0 -2
- package/index-b71998f1.mjs.map +0 -1
- package/logger-04bad527.cjs +0 -2
- package/logger-04bad527.cjs.map +0 -1
- package/logger-2598bf05.mjs +0 -2
- package/logger-2598bf05.mjs.map +0 -1
- package/logger.d-37185354.d.ts +0 -21
- package/query-builder-2f2e8229.cjs +0 -2
- package/query-builder-2f2e8229.cjs.map +0 -1
- package/query-builder-2fcde2f0.mjs +0 -2
- package/query-builder-2fcde2f0.mjs.map +0 -1
- package/query-promise-2c5b43ab.cjs +0 -2
- package/query-promise-2c5b43ab.cjs.map +0 -1
- package/query-promise-a65edd44.mjs +0 -2
- package/query-promise-a65edd44.mjs.map +0 -1
- package/query-promise.d-a8af8583.d.ts +0 -9
- package/session-8a621f09.mjs +0 -8
- package/session-8a621f09.mjs.map +0 -1
- package/session-b6939bab.cjs +0 -14
- package/session-b6939bab.cjs.map +0 -1
- package/session-b977ce56.mjs +0 -14
- package/session-b977ce56.mjs.map +0 -1
- package/session-c891400d.mjs +0 -8
- package/session-c891400d.mjs.map +0 -1
- package/session-e6db6732.cjs +0 -8
- package/session-e6db6732.cjs.map +0 -1
- package/session-ef1ef979.cjs +0 -8
- package/session-ef1ef979.cjs.map +0 -1
- package/utils-9d882195.cjs +0 -2
- package/utils-9d882195.cjs.map +0 -1
- package/utils-e6870670.mjs +0 -2
- package/utils-e6870670.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { S as SQL, k as ColumnBuilderHKTBase, ax as Assume, i as ColumnBuilderBaseConfig, b as ColumnHKTBase, C as ColumnBaseConfig, o as ColumnBuilder, at as Update, e as Column, f as AnyColumnHKT, ag as TableConfig$1, T as Table, ah as UpdateTableConfig, ak as AnyTableHKT, r as BuildColumns, B as BuildColumn, p as AnyColumnBuilder, aK as ColumnsSelection, V as View, ad as Subquery, ae as WithSubquery, aA as ValueOrArray, a9 as Placeholder, av as Simplify, H as Query, aj as AnyTable, v as SelectedFieldsFlat$1, x as SelectedFields$1, y as SelectedFieldsOrdered$1, J as SQLWrapper, aq as InferModel, ar as UpdateSet, G as GetColumnData, a5 as Param, $ as DriverValueEncoder, Q as QueryTypingsValue, A as AnyColumn, aI as KnownKeysOnly } from './column.d-c31e7ad3.js';
|
|
1
2
|
import { MigrationMeta } from './migrator.js';
|
|
2
|
-
import {
|
|
3
|
-
import { T as TypedQueryBuilder, A as AddAliasToSelection, G as GetSelectTableName, a as GetSelectTableSelection, S as SelectMode, J as JoinNullability, B as BuildSubquerySelection, b as SelectResult, c as JoinType, M as MapColumnsToTableAlias, d as AppendToResult, e as AppendToNullabilityMap, f as SelectResultFields } from './select.types.d-
|
|
4
|
-
import { Q as QueryPromise } from './query-promise.d-a8af8583.js';
|
|
3
|
+
import { Q as QueryPromise, J as TablesRelationalConfig, I as TableRelationalConfig, H as DBQueryConfig, a2 as BuildRelationalQueryResult, U as BuildQueryResult, L as ExtractTablesWithRelations, K as RelationalSchemaConfig } from './query-promise.d-e370e0a9.js';
|
|
4
|
+
import { T as TypedQueryBuilder, A as AddAliasToSelection, G as GetSelectTableName, a as GetSelectTableSelection, S as SelectMode, J as JoinNullability, B as BuildSubquerySelection, b as SelectResult, c as JoinType, M as MapColumnsToTableAlias, d as AppendToResult, e as AppendToNullabilityMap, f as SelectResultFields } from './select.types.d-34d7f74e.js';
|
|
5
5
|
|
|
6
6
|
declare class CheckBuilder {
|
|
7
7
|
name: string;
|
|
@@ -90,6 +90,9 @@ declare abstract class PgColumn<THKT extends ColumnHKTBase, T extends ColumnBase
|
|
|
90
90
|
}> {
|
|
91
91
|
}
|
|
92
92
|
type AnyPgColumn<TPartial extends Partial<ColumnBaseConfig> = {}> = PgColumn<PgColumnHKT, Required<Update<ColumnBaseConfig, TPartial>>>;
|
|
93
|
+
interface AnyPgColumnHKT extends AnyColumnHKT {
|
|
94
|
+
type: AnyPgColumn<Assume<this['config'], Partial<ColumnBaseConfig>>>;
|
|
95
|
+
}
|
|
93
96
|
|
|
94
97
|
interface IndexConfig {
|
|
95
98
|
name?: string;
|
|
@@ -138,8 +141,8 @@ interface IndexBuilder extends AnyIndexBuilder {
|
|
|
138
141
|
}
|
|
139
142
|
declare class IndexBuilder implements AnyIndexBuilder {
|
|
140
143
|
constructor(columns: IndexColumn[], unique: boolean, only: boolean, name?: string);
|
|
141
|
-
concurrently():
|
|
142
|
-
using(method: SQL):
|
|
144
|
+
concurrently(): this;
|
|
145
|
+
using(method: SQL): this;
|
|
143
146
|
asc(): Omit<this, 'asc' | 'desc'>;
|
|
144
147
|
desc(): Omit<this, 'asc' | 'desc'>;
|
|
145
148
|
nullsFirst(): Omit<this, 'nullsFirst' | 'nullsLast'>;
|
|
@@ -174,6 +177,9 @@ type TableConfig = TableConfig$1<AnyPgColumn>;
|
|
|
174
177
|
declare class PgTable<T extends TableConfig> extends Table<T> {
|
|
175
178
|
}
|
|
176
179
|
type AnyPgTable<TPartial extends Partial<TableConfig> = {}> = PgTable<UpdateTableConfig<TableConfig, TPartial>>;
|
|
180
|
+
interface AnyPgTableHKT extends AnyTableHKT {
|
|
181
|
+
type: AnyPgTable<Assume<this['config'], Partial<TableConfig>>>;
|
|
182
|
+
}
|
|
177
183
|
type PgTableWithColumns<T extends TableConfig> = PgTable<T> & {
|
|
178
184
|
[Key in keyof T['columns']]: T['columns'][Key];
|
|
179
185
|
};
|
|
@@ -363,6 +369,12 @@ declare class PgSelectBuilder<TSelection extends SelectedFields | undefined, TBu
|
|
|
363
369
|
private dialect;
|
|
364
370
|
private withList;
|
|
365
371
|
constructor(fields: TSelection, session: PgSession | undefined, dialect: PgDialect, withList?: Subquery[]);
|
|
372
|
+
/**
|
|
373
|
+
* Specify the table, subquery, or other target that you’re
|
|
374
|
+
* building a select query against.
|
|
375
|
+
*
|
|
376
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM|Postgres from documentation}
|
|
377
|
+
*/
|
|
366
378
|
from<TFrom extends AnyPgTable | Subquery | PgViewBase | SQL>(source: TFrom): CreatePgSelectFromBuilderMode<TBuilderMode, GetSelectTableName<TFrom>, TSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection, TSelection extends undefined ? 'single' : 'partial'>;
|
|
367
379
|
}
|
|
368
380
|
declare abstract class PgSelectQueryBuilder<THKT extends PgSelectHKTBase, TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends TypedQueryBuilder<BuildSubquerySelection<TSelection, TNullabilityMap>, SelectResult<TSelection, TSelectMode, TNullabilityMap>[]> {
|
|
@@ -380,18 +392,126 @@ declare abstract class PgSelectQueryBuilder<THKT extends PgSelectHKTBase, TTable
|
|
|
380
392
|
private tableName;
|
|
381
393
|
constructor(table: PgSelectConfig['table'], fields: PgSelectConfig['fields'], isPartialSelect: boolean, session: PgSession | undefined, dialect: PgDialect, withList: Subquery[]);
|
|
382
394
|
private createJoin;
|
|
395
|
+
/**
|
|
396
|
+
* For each row of the table, include
|
|
397
|
+
* values from a matching row of the joined
|
|
398
|
+
* table, if there is a matching row. If not,
|
|
399
|
+
* all of the columns of the joined table
|
|
400
|
+
* will be set to null.
|
|
401
|
+
*/
|
|
383
402
|
leftJoin: JoinFn<THKT, TTableName, TSelectMode, "left", TSelection, TNullabilityMap>;
|
|
403
|
+
/**
|
|
404
|
+
* Includes all of the rows of the joined table.
|
|
405
|
+
* If there is no matching row in the main table,
|
|
406
|
+
* all the columns of the main table will be
|
|
407
|
+
* set to null.
|
|
408
|
+
*/
|
|
384
409
|
rightJoin: JoinFn<THKT, TTableName, TSelectMode, "right", TSelection, TNullabilityMap>;
|
|
410
|
+
/**
|
|
411
|
+
* This is the default type of join.
|
|
412
|
+
*
|
|
413
|
+
* For each row of the table, the joined table
|
|
414
|
+
* needs to have a matching row, or it will
|
|
415
|
+
* be excluded from results.
|
|
416
|
+
*/
|
|
385
417
|
innerJoin: JoinFn<THKT, TTableName, TSelectMode, "inner", TSelection, TNullabilityMap>;
|
|
418
|
+
/**
|
|
419
|
+
* Rows from both the main & joined are included,
|
|
420
|
+
* regardless of whether or not they have matching
|
|
421
|
+
* rows in the other table.
|
|
422
|
+
*/
|
|
386
423
|
fullJoin: JoinFn<THKT, TTableName, TSelectMode, "full", TSelection, TNullabilityMap>;
|
|
424
|
+
/**
|
|
425
|
+
* Specify a condition to narrow the result set. Multiple
|
|
426
|
+
* conditions can be combined with the `and` and `or`
|
|
427
|
+
* functions.
|
|
428
|
+
*
|
|
429
|
+
* ## Examples
|
|
430
|
+
*
|
|
431
|
+
* ```ts
|
|
432
|
+
* // Find cars made in the year 2000
|
|
433
|
+
* db.select().from(cars).where(eq(cars.year, 2000));
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
387
436
|
where(where: ((aliases: TSelection) => SQL | undefined) | SQL | undefined): this;
|
|
437
|
+
/**
|
|
438
|
+
* Sets the HAVING clause of this query, which often
|
|
439
|
+
* used with GROUP BY and filters rows after they've been
|
|
440
|
+
* grouped together and combined.
|
|
441
|
+
*
|
|
442
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-HAVING|Postgres having clause documentation}
|
|
443
|
+
*/
|
|
388
444
|
having(having: ((aliases: TSelection) => SQL | undefined) | SQL | undefined): this;
|
|
445
|
+
/**
|
|
446
|
+
* Specify the GROUP BY of this query: given
|
|
447
|
+
* a list of columns or SQL expressions, Postgres will
|
|
448
|
+
* combine all rows with the same values in those columns
|
|
449
|
+
* into a single row.
|
|
450
|
+
*
|
|
451
|
+
* ## Examples
|
|
452
|
+
*
|
|
453
|
+
* ```ts
|
|
454
|
+
* // Group and count people by their last names
|
|
455
|
+
* db.select({
|
|
456
|
+
* lastName: people.lastName,
|
|
457
|
+
* count: sql<number>`count(*)::integer`
|
|
458
|
+
* }).from(people).groupBy(people.lastName);
|
|
459
|
+
* ```
|
|
460
|
+
*
|
|
461
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-GROUPBY|Postgres GROUP BY documentation}
|
|
462
|
+
*/
|
|
389
463
|
groupBy(builder: (aliases: TSelection) => ValueOrArray<AnyPgColumn | SQL | SQL.Aliased>): this;
|
|
390
464
|
groupBy(...columns: (AnyPgColumn | SQL | SQL.Aliased)[]): this;
|
|
465
|
+
/**
|
|
466
|
+
* Specify the ORDER BY clause of this query: a number of
|
|
467
|
+
* columns or SQL expressions that will control sorting
|
|
468
|
+
* of results. You can specify whether results are in ascending
|
|
469
|
+
* or descending order with the `asc()` and `desc()` operators.
|
|
470
|
+
*
|
|
471
|
+
* ## Examples
|
|
472
|
+
*
|
|
473
|
+
* ```
|
|
474
|
+
* // Select cars by year released
|
|
475
|
+
* db.select().from(cars).orderBy(cars.year);
|
|
476
|
+
* ```
|
|
477
|
+
*
|
|
478
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-ORDERBY|Postgres ORDER BY documentation}
|
|
479
|
+
*/
|
|
391
480
|
orderBy(builder: (aliases: TSelection) => ValueOrArray<AnyPgColumn | SQL | SQL.Aliased>): this;
|
|
392
481
|
orderBy(...columns: (AnyPgColumn | SQL | SQL.Aliased)[]): this;
|
|
482
|
+
/**
|
|
483
|
+
* Set the maximum number of rows that will be
|
|
484
|
+
* returned by this query.
|
|
485
|
+
*
|
|
486
|
+
* ## Examples
|
|
487
|
+
*
|
|
488
|
+
* ```ts
|
|
489
|
+
* // Get the first 10 people from this query.
|
|
490
|
+
* db.select().from(people).limit(10);
|
|
491
|
+
* ```
|
|
492
|
+
*
|
|
493
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-LIMIT|Postgres LIMIT documentation}
|
|
494
|
+
*/
|
|
393
495
|
limit(limit: number | Placeholder): this;
|
|
496
|
+
/**
|
|
497
|
+
* Skip a number of rows when returning results
|
|
498
|
+
* from this query.
|
|
499
|
+
*
|
|
500
|
+
* ## Examples
|
|
501
|
+
*
|
|
502
|
+
* ```ts
|
|
503
|
+
* // Get the 10th-20th people from this query.
|
|
504
|
+
* db.select().from(people).offset(10).limit(10);
|
|
505
|
+
* ```
|
|
506
|
+
*/
|
|
394
507
|
offset(offset: number | Placeholder): this;
|
|
508
|
+
/**
|
|
509
|
+
* The FOR clause specifies a lock strength for this query
|
|
510
|
+
* that controls how strictly it acquires exclusive access to
|
|
511
|
+
* the rows being queried.
|
|
512
|
+
*
|
|
513
|
+
* {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE|Postgres locking clause documentation}
|
|
514
|
+
*/
|
|
395
515
|
for(strength: LockStrength, config?: LockConfig): this;
|
|
396
516
|
toSQL(): Simplify<Omit<Query, 'typings'>>;
|
|
397
517
|
as<TAlias extends string>(alias: TAlias): SubqueryWithSelection<BuildSubquerySelection<TSelection, TNullabilityMap>, TAlias>;
|
|
@@ -400,6 +520,13 @@ interface PgSelect<TTableName extends string | undefined, TSelection extends Col
|
|
|
400
520
|
}
|
|
401
521
|
declare class PgSelect<TTableName extends string | undefined, TSelection, TSelectMode extends SelectMode, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}> extends PgSelectQueryBuilder<PgSelectHKT, TTableName, TSelection, TSelectMode, TNullabilityMap> {
|
|
402
522
|
private _prepare;
|
|
523
|
+
/**
|
|
524
|
+
* Create a prepared statement for this query. This allows
|
|
525
|
+
* the database to remember this query for the given session
|
|
526
|
+
* and call it by name, rather than specifying the full query.
|
|
527
|
+
*
|
|
528
|
+
* {@link https://www.postgresql.org/docs/current/sql-prepare.html|Postgres prepare documentation}
|
|
529
|
+
*/
|
|
403
530
|
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
|
|
404
531
|
execute: SelectResult<TSelection, TSelectMode, TNullabilityMap>[];
|
|
405
532
|
}>;
|
|
@@ -420,6 +547,7 @@ type BuildAliasTable<TTable extends AnyTable, TAlias extends string> = PgTableWi
|
|
|
420
547
|
interface PgSelectConfig {
|
|
421
548
|
withList: Subquery[];
|
|
422
549
|
fields: Record<string, unknown>;
|
|
550
|
+
fieldsFlat?: SelectedFieldsOrdered;
|
|
423
551
|
where?: SQL;
|
|
424
552
|
having?: SQL;
|
|
425
553
|
table: AnyPgTable | Subquery | PgViewBase | SQL;
|
|
@@ -483,20 +611,30 @@ interface PgTransactionConfig {
|
|
|
483
611
|
accessMode?: 'read only' | 'read write';
|
|
484
612
|
deferrable?: boolean;
|
|
485
613
|
}
|
|
486
|
-
declare abstract class PgSession<TQueryResult extends QueryResultHKT = QueryResultHKT> {
|
|
614
|
+
declare abstract class PgSession<TQueryResult extends QueryResultHKT = QueryResultHKT, TFullSchema extends Record<string, unknown> = Record<string, never>, TSchema extends TablesRelationalConfig = Record<string, never>> {
|
|
487
615
|
protected dialect: PgDialect;
|
|
488
616
|
constructor(dialect: PgDialect);
|
|
489
|
-
abstract prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined): PreparedQuery<T>;
|
|
617
|
+
abstract prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQuery<T>;
|
|
490
618
|
execute<T>(query: SQL): Promise<T>;
|
|
491
619
|
all<T = unknown>(query: SQL): Promise<T[]>;
|
|
492
|
-
|
|
620
|
+
values<T = unknown>(query: SQL): Promise<T[]>;
|
|
621
|
+
abstract transaction<T>(transaction: (tx: PgTransaction<TQueryResult, TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
|
493
622
|
}
|
|
494
|
-
declare abstract class PgTransaction<TQueryResult extends QueryResultHKT> extends PgDatabase<TQueryResult> {
|
|
623
|
+
declare abstract class PgTransaction<TQueryResult extends QueryResultHKT, TFullSchema extends Record<string, unknown> = Record<string, never>, TSchema extends TablesRelationalConfig = Record<string, never>> extends PgDatabase<TQueryResult, TFullSchema, TSchema> {
|
|
624
|
+
protected schema: {
|
|
625
|
+
fullSchema: Record<string, unknown>;
|
|
626
|
+
schema: TSchema;
|
|
627
|
+
tableNamesMap: Record<string, string>;
|
|
628
|
+
} | undefined;
|
|
495
629
|
protected readonly nestedIndex: number;
|
|
496
|
-
constructor(dialect: PgDialect, session: PgSession,
|
|
630
|
+
constructor(dialect: PgDialect, session: PgSession<any, any, any>, schema: {
|
|
631
|
+
fullSchema: Record<string, unknown>;
|
|
632
|
+
schema: TSchema;
|
|
633
|
+
tableNamesMap: Record<string, string>;
|
|
634
|
+
} | undefined, nestedIndex?: number);
|
|
497
635
|
rollback(): never;
|
|
498
636
|
setTransaction(config: PgTransactionConfig): Promise<void>;
|
|
499
|
-
abstract transaction<T>(transaction: (tx: PgTransaction<TQueryResult>) => Promise<T>): Promise<T>;
|
|
637
|
+
abstract transaction<T>(transaction: (tx: PgTransaction<TQueryResult, TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
500
638
|
}
|
|
501
639
|
interface QueryResultHKT {
|
|
502
640
|
readonly $brand: 'QueryRowHKT';
|
|
@@ -671,7 +809,7 @@ declare class PgDialect {
|
|
|
671
809
|
* If `isSingleTable` is true, then columns won't be prefixed with table name
|
|
672
810
|
*/
|
|
673
811
|
private buildSelection;
|
|
674
|
-
buildSelectQuery({ withList, fields, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClauses }: PgSelectConfig): SQL;
|
|
812
|
+
buildSelectQuery({ withList, fields, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClauses }: PgSelectConfig): SQL;
|
|
675
813
|
buildInsertQuery({ table, values, onConflict, returning }: PgInsertConfig): SQL;
|
|
676
814
|
buildRefreshMaterializedViewQuery({ view, concurrently, withNoData }: {
|
|
677
815
|
view: PgMaterializedView;
|
|
@@ -680,14 +818,53 @@ declare class PgDialect {
|
|
|
680
818
|
}): SQL;
|
|
681
819
|
prepareTyping(encoder: DriverValueEncoder<unknown, unknown>): QueryTypingsValue;
|
|
682
820
|
sqlToQuery(sql: SQL): Query;
|
|
821
|
+
buildRelationalQuery(fullSchema: Record<string, unknown>, schema: TablesRelationalConfig, tableNamesMap: Record<string, string>, table: AnyPgTable, tableConfig: TableRelationalConfig, config: true | DBQueryConfig<'many', true>, tableAlias: string, relationColumns: AnyColumn[], isRoot?: boolean): BuildRelationalQueryResult;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
declare class RelationalQueryBuilder<TSchema extends TablesRelationalConfig, TFields extends TableRelationalConfig> {
|
|
825
|
+
private fullSchema;
|
|
826
|
+
private schema;
|
|
827
|
+
private tableNamesMap;
|
|
828
|
+
private table;
|
|
829
|
+
private tableConfig;
|
|
830
|
+
private dialect;
|
|
831
|
+
private session;
|
|
832
|
+
constructor(fullSchema: Record<string, unknown>, schema: TSchema, tableNamesMap: Record<string, string>, table: AnyPgTable, tableConfig: TableRelationalConfig, dialect: PgDialect, session: PgSession);
|
|
833
|
+
findMany<TConfig extends DBQueryConfig<'many', true, TSchema, TFields>>(config?: KnownKeysOnly<TConfig, DBQueryConfig<'many', true, TSchema, TFields>>): PgRelationalQuery<BuildQueryResult<TSchema, TFields, TConfig>[]>;
|
|
834
|
+
findFirst<TSelection extends Omit<DBQueryConfig<'many', true, TSchema, TFields>, 'limit'>>(config?: KnownKeysOnly<TSelection, Omit<DBQueryConfig<'many', true, TSchema, TFields>, 'limit'>>): PgRelationalQuery<BuildQueryResult<TSchema, TFields, TSelection> | undefined>;
|
|
835
|
+
}
|
|
836
|
+
declare class PgRelationalQuery<TResult> extends QueryPromise<TResult> {
|
|
837
|
+
private fullSchema;
|
|
838
|
+
private schema;
|
|
839
|
+
private tableNamesMap;
|
|
840
|
+
private table;
|
|
841
|
+
private tableConfig;
|
|
842
|
+
private dialect;
|
|
843
|
+
private session;
|
|
844
|
+
private config;
|
|
845
|
+
private mode;
|
|
846
|
+
protected $brand: 'PgRelationalQuery';
|
|
847
|
+
constructor(fullSchema: Record<string, unknown>, schema: TablesRelationalConfig, tableNamesMap: Record<string, string>, table: AnyPgTable, tableConfig: TableRelationalConfig, dialect: PgDialect, session: PgSession, config: DBQueryConfig<'many', true> | true, mode: 'many' | 'first');
|
|
848
|
+
private _prepare;
|
|
849
|
+
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
|
|
850
|
+
execute: TResult;
|
|
851
|
+
}>;
|
|
852
|
+
execute(): Promise<TResult>;
|
|
683
853
|
}
|
|
684
854
|
|
|
685
|
-
declare class PgDatabase<TQueryResult extends QueryResultHKT> {
|
|
855
|
+
declare class PgDatabase<TQueryResult extends QueryResultHKT, TFullSchema extends Record<string, unknown> = Record<string, never>, TSchema extends TablesRelationalConfig = ExtractTablesWithRelations<TFullSchema>> {
|
|
856
|
+
readonly _: {
|
|
857
|
+
readonly schema: TSchema | undefined;
|
|
858
|
+
readonly tableNamesMap: Record<string, string>;
|
|
859
|
+
};
|
|
860
|
+
query: {
|
|
861
|
+
[K in keyof TSchema]: RelationalQueryBuilder<TSchema, TSchema[K]>;
|
|
862
|
+
};
|
|
686
863
|
constructor(
|
|
687
864
|
/** @internal */
|
|
688
865
|
dialect: PgDialect,
|
|
689
866
|
/** @internal */
|
|
690
|
-
session: PgSession<any>);
|
|
867
|
+
session: PgSession<any, any, any>, schema: RelationalSchemaConfig<TSchema> | undefined);
|
|
691
868
|
$with<TAlias extends string>(alias: TAlias): {
|
|
692
869
|
as<TSelection extends ColumnsSelection>(qb: TypedQueryBuilder<TSelection, unknown> | ((qb: QueryBuilder) => TypedQueryBuilder<TSelection, unknown>)): WithSubqueryWithSelection<TSelection, TAlias>;
|
|
693
870
|
};
|
|
@@ -704,7 +881,7 @@ declare class PgDatabase<TQueryResult extends QueryResultHKT> {
|
|
|
704
881
|
delete<TTable extends AnyPgTable>(table: TTable): PgDelete<TTable, TQueryResult>;
|
|
705
882
|
refreshMaterializedView<TView extends PgMaterializedView>(view: TView): PgRefreshMaterializedView<TQueryResult>;
|
|
706
883
|
execute<TRow extends Record<string, unknown> = Record<string, unknown>>(query: SQLWrapper): Promise<QueryResultKind<TQueryResult, TRow>>;
|
|
707
|
-
transaction<T>(transaction: (tx: PgTransaction<TQueryResult>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
|
884
|
+
transaction<T>(transaction: (tx: PgTransaction<TQueryResult, TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
|
708
885
|
}
|
|
709
886
|
|
|
710
|
-
export {
|
|
887
|
+
export { PgInsertValue as $, AnyPgTable as A, BuildAliasTable as B, Check as C, Reference as D, ForeignKeyBuilder as E, ForeignKey as F, AnyForeignKeyBuilder as G, foreignKey as H, Index as I, IndexColumn as J, IndexBuilderOn as K, AnyIndexBuilder as L, IndexBuilder as M, GetColumnsTableName as N, index as O, PreparedQueryConfig as P, QueryResultHKT as Q, ReferenceConfig as R, SelectedFieldsOrdered as S, uniqueIndex as T, UpdateDeleteAction as U, ViewWithConfig as V, primaryKey as W, PrimaryKeyBuilder as X, PgDeleteConfig as Y, PgDelete as Z, PgInsertConfig as _, PreparedQuery as a, PgInsertBuilder as a0, PgInsert as a1, QueryBuilder as a2, PgRefreshMaterializedView as a3, PgSelectBuilder as a4, PgSelectQueryBuilder as a5, PgSelect as a6, JoinsValue as a7, AnyPgSelect as a8, PgSelectConfig as a9, MaterializedViewBuilderCore as aA, MaterializedViewBuilder as aB, ManualMaterializedViewBuilder as aC, PgViewBase as aD, PgViewConfig as aE, PgViewWithSelection as aF, PgMaterializedViewConfig as aG, PgMaterializedViewWithSelection as aH, JoinFn as aa, SelectedFieldsFlat as ab, SelectedFields as ac, LockStrength as ad, LockConfig as ae, PgSelectHKTBase as af, PgSelectKind as ag, PgSelectQueryBuilderHKT as ah, PgSelectHKT as ai, PgUpdateConfig as aj, PgUpdateSetSource as ak, PgUpdateBuilder as al, PgUpdate as am, QueryResultKind as an, SubqueryWithSelection as ao, WithSubqueryWithSelection as ap, PgTableExtraConfig as aq, TableConfig as ar, PgTable as as, AnyPgTableHKT as at, PgTableWithColumns as au, pgTable as av, pgTableCreator as aw, DefaultViewBuilderCore as ax, ViewBuilder as ay, ManualViewBuilder as az, PgSession as b, PgDialect as c, PgTransactionConfig as d, PgTransaction as e, PgDatabase as f, PgColumnBuilder as g, PgColumn as h, PgTableFn as i, pgMaterializedView as j, AnyPgColumn as k, PrimaryKey as l, PgView as m, PgMaterializedView as n, PgMaterializedViewWithConfig as o, pgView as p, CheckBuilder as q, check as r, PgArrayBuilderHKT as s, PgArrayHKT as t, PgArrayBuilder as u, PgArray as v, PgColumnBuilderHKT as w, PgColumnHKT as x, AnyPgColumnBuilder as y, AnyPgColumnHKT as z };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Database } from 'sql.js';
|
|
2
|
+
import { B as BaseSQLiteDatabase } from './db.d-a2311092.js';
|
|
3
|
+
import { aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
4
|
+
|
|
5
|
+
type SQLJsDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = BaseSQLiteDatabase<'sync', void, TSchema>;
|
|
6
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: Database, config?: DrizzleConfig<TSchema>): SQLJsDatabase<TSchema>;
|
|
7
|
+
|
|
8
|
+
export { SQLJsDatabase as S, drizzle as d };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Q as QueryTypingsValue, L as Logger, H as Query, S as SQL, aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
2
|
+
import { P as PreparedQueryConfig, a as PreparedQuery, S as SelectedFieldsOrdered, b as PgSession, c as PgDialect, d as PgTransactionConfig, e as PgTransaction, Q as QueryResultHKT, f as PgDatabase } from './db.d-bc9a1d6c.js';
|
|
3
|
+
import { RDSDataClient, ExecuteStatementCommandOutput } from '@aws-sdk/client-rds-data';
|
|
4
|
+
import { J as TablesRelationalConfig, K as RelationalSchemaConfig } from './query-promise.d-e370e0a9.js';
|
|
5
|
+
|
|
6
|
+
type AwsDataApiClient = RDSDataClient;
|
|
7
|
+
declare class AwsDataApiPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
|
|
8
|
+
private client;
|
|
9
|
+
private params;
|
|
10
|
+
private typings;
|
|
11
|
+
private options;
|
|
12
|
+
private fields;
|
|
13
|
+
private customResultMapper?;
|
|
14
|
+
private rawQuery;
|
|
15
|
+
constructor(client: AwsDataApiClient, queryString: string, params: unknown[], typings: QueryTypingsValue[], options: AwsDataApiSessionOptions, fields: SelectedFieldsOrdered | undefined,
|
|
16
|
+
/** @internal */
|
|
17
|
+
transactionId: string | undefined, customResultMapper?: ((rows: unknown[][]) => T['execute']) | undefined);
|
|
18
|
+
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
|
19
|
+
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
|
|
20
|
+
values(placeholderValues?: Record<string, unknown>): Promise<T['values']>;
|
|
21
|
+
}
|
|
22
|
+
interface AwsDataApiSessionOptions {
|
|
23
|
+
logger?: Logger;
|
|
24
|
+
database: string;
|
|
25
|
+
resourceArn: string;
|
|
26
|
+
secretArn: string;
|
|
27
|
+
}
|
|
28
|
+
declare class AwsDataApiSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<AwsDataApiPgQueryResultHKT, TFullSchema, TSchema> {
|
|
29
|
+
private schema;
|
|
30
|
+
private options;
|
|
31
|
+
constructor(
|
|
32
|
+
/** @internal */
|
|
33
|
+
client: AwsDataApiClient, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options: AwsDataApiSessionOptions,
|
|
34
|
+
/** @internal */
|
|
35
|
+
transactionId: string | undefined);
|
|
36
|
+
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, transactionId?: string, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQuery<T>;
|
|
37
|
+
execute<T>(query: SQL): Promise<T>;
|
|
38
|
+
transaction<T>(transaction: (tx: AwsDataApiTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig | undefined): Promise<T>;
|
|
39
|
+
}
|
|
40
|
+
declare class AwsDataApiTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<AwsDataApiPgQueryResultHKT, TFullSchema, TSchema> {
|
|
41
|
+
transaction<T>(transaction: (tx: AwsDataApiTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
42
|
+
}
|
|
43
|
+
interface AwsDataApiPgQueryResultHKT extends QueryResultHKT {
|
|
44
|
+
type: ExecuteStatementCommandOutput;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PgDriverOptions {
|
|
48
|
+
logger?: Logger;
|
|
49
|
+
database: string;
|
|
50
|
+
resourceArn: string;
|
|
51
|
+
secretArn: string;
|
|
52
|
+
}
|
|
53
|
+
interface DrizzleAwsDataApiPgConfig<TSchema extends Record<string, unknown> = Record<string, never>> extends DrizzleConfig<TSchema> {
|
|
54
|
+
database: string;
|
|
55
|
+
resourceArn: string;
|
|
56
|
+
secretArn: string;
|
|
57
|
+
}
|
|
58
|
+
type AwsDataApiPgDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = PgDatabase<AwsDataApiPgQueryResultHKT, TSchema>;
|
|
59
|
+
declare class AwsPgDialect extends PgDialect {
|
|
60
|
+
escapeParam(num: number): string;
|
|
61
|
+
}
|
|
62
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: AwsDataApiClient, config: DrizzleAwsDataApiPgConfig<TSchema>): AwsDataApiPgDatabase<TSchema>;
|
|
63
|
+
|
|
64
|
+
export { AwsDataApiPgDatabase as A, DrizzleAwsDataApiPgConfig as D, PgDriverOptions as P, AwsPgDialect as a, AwsDataApiClient as b, AwsDataApiPreparedQuery as c, drizzle as d, AwsDataApiSessionOptions as e, AwsDataApiSession as f, AwsDataApiTransaction as g, AwsDataApiPgQueryResultHKT as h };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Connection as Connection$1, Pool as Pool$1 } from 'mysql2';
|
|
2
|
+
import { L as Logger, H as Query, S as SQL, ax as Assume, aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
3
|
+
import { ae as PreparedQueryConfig, ah as PreparedQuery, a1 as SelectedFieldsOrdered, aj as MySqlSession, o as MySqlDialect, ag as PreparedQueryKind, ai as MySqlTransactionConfig, ak as MySqlTransaction, ac as QueryResultHKT, af as PreparedQueryHKT, n as MySqlDatabase } from './select.types.d-ae2f8e44.js';
|
|
4
|
+
import { J as TablesRelationalConfig, K as RelationalSchemaConfig } from './query-promise.d-e370e0a9.js';
|
|
5
|
+
import { Pool, Connection, ResultSetHeader, FieldPacket, RowDataPacket, OkPacket } from 'mysql2/promise';
|
|
6
|
+
|
|
7
|
+
type MySql2Client = Pool | Connection;
|
|
8
|
+
type MySqlRawQueryResult = [ResultSetHeader, FieldPacket[]];
|
|
9
|
+
type MySqlQueryResultType = RowDataPacket[][] | RowDataPacket[] | OkPacket | OkPacket[] | ResultSetHeader;
|
|
10
|
+
type MySqlQueryResult<T = any> = [T extends ResultSetHeader ? T : T[], FieldPacket[]];
|
|
11
|
+
declare class MySql2PreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
|
|
12
|
+
private client;
|
|
13
|
+
private params;
|
|
14
|
+
private logger;
|
|
15
|
+
private fields;
|
|
16
|
+
private customResultMapper?;
|
|
17
|
+
private rawQuery;
|
|
18
|
+
private query;
|
|
19
|
+
constructor(client: MySql2Client, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows: unknown[][]) => T['execute']) | undefined);
|
|
20
|
+
execute(placeholderValues?: Record<string, unknown>): Promise<T['execute']>;
|
|
21
|
+
iterator(placeholderValues?: Record<string, unknown>): AsyncGenerator<T['execute'] extends any[] ? T['execute'][number] : T['execute']>;
|
|
22
|
+
}
|
|
23
|
+
interface MySql2SessionOptions {
|
|
24
|
+
logger?: Logger;
|
|
25
|
+
}
|
|
26
|
+
declare class MySql2Session<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlSession<MySql2QueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {
|
|
27
|
+
private client;
|
|
28
|
+
private schema;
|
|
29
|
+
private options;
|
|
30
|
+
private logger;
|
|
31
|
+
constructor(client: MySql2Client, dialect: MySqlDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: MySql2SessionOptions);
|
|
32
|
+
prepareQuery<T extends PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQueryKind<MySql2PreparedQueryHKT, T>;
|
|
33
|
+
all<T = unknown>(query: SQL<unknown>): Promise<T[]>;
|
|
34
|
+
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>, config?: MySqlTransactionConfig): Promise<T>;
|
|
35
|
+
}
|
|
36
|
+
declare class MySql2Transaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends MySqlTransaction<MySql2QueryResultHKT, MySql2PreparedQueryHKT, TFullSchema, TSchema> {
|
|
37
|
+
transaction<T>(transaction: (tx: MySql2Transaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
38
|
+
}
|
|
39
|
+
interface MySql2QueryResultHKT extends QueryResultHKT {
|
|
40
|
+
type: MySqlRawQueryResult;
|
|
41
|
+
}
|
|
42
|
+
interface MySql2PreparedQueryHKT extends PreparedQueryHKT {
|
|
43
|
+
type: MySql2PreparedQuery<Assume<this['config'], PreparedQueryConfig>>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface MySqlDriverOptions {
|
|
47
|
+
logger?: Logger;
|
|
48
|
+
}
|
|
49
|
+
declare class MySql2Driver {
|
|
50
|
+
private client;
|
|
51
|
+
private dialect;
|
|
52
|
+
private options;
|
|
53
|
+
constructor(client: MySql2Client, dialect: MySqlDialect, options?: MySqlDriverOptions);
|
|
54
|
+
createSession(schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined): MySql2Session<Record<string, unknown>, TablesRelationalConfig>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type MySql2Database<TSchema extends Record<string, unknown> = Record<string, never>> = MySqlDatabase<MySql2QueryResultHKT, MySql2PreparedQueryHKT, TSchema>;
|
|
58
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: MySql2Client | Connection$1 | Pool$1, config?: DrizzleConfig<TSchema>): MySql2Database<TSchema>;
|
|
59
|
+
|
|
60
|
+
export { MySqlDriverOptions as M, MySql2Driver as a, MySql2Database as b, MySql2Client as c, drizzle as d, MySqlRawQueryResult as e, MySqlQueryResultType as f, MySqlQueryResult as g, MySql2PreparedQuery as h, MySql2SessionOptions as i, MySql2Session as j, MySql2Transaction as k, MySql2QueryResultHKT as l, MySql2PreparedQueryHKT as m };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResultSet, Client } from '@libsql/client';
|
|
2
|
+
import { B as BaseSQLiteDatabase } from './db.d-a2311092.js';
|
|
3
|
+
import { aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
4
|
+
|
|
5
|
+
type LibSQLDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = BaseSQLiteDatabase<'async', ResultSet, TSchema>;
|
|
6
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: Client, config?: DrizzleConfig<TSchema>): LibSQLDatabase<TSchema>;
|
|
7
|
+
|
|
8
|
+
export { LibSQLDatabase as L, drizzle as d };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { L as Logger, H as Query, ax as Assume, aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
2
|
+
import { P as PreparedQueryConfig, a as PreparedQuery, S as SelectedFieldsOrdered, b as PgSession, c as PgDialect, d as PgTransactionConfig, e as PgTransaction, Q as QueryResultHKT, f as PgDatabase } from './db.d-bc9a1d6c.js';
|
|
3
|
+
import { J as TablesRelationalConfig, K as RelationalSchemaConfig } from './query-promise.d-e370e0a9.js';
|
|
4
|
+
import { Pool, PoolClient, Client, QueryResult, QueryResultRow } from '@neondatabase/serverless';
|
|
5
|
+
|
|
6
|
+
type NeonClient = Pool | PoolClient | Client;
|
|
7
|
+
declare class NeonPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
|
|
8
|
+
private client;
|
|
9
|
+
private params;
|
|
10
|
+
private logger;
|
|
11
|
+
private fields;
|
|
12
|
+
private customResultMapper?;
|
|
13
|
+
private rawQuery;
|
|
14
|
+
private query;
|
|
15
|
+
constructor(client: NeonClient, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, name: string | undefined, customResultMapper?: ((rows: unknown[][]) => T['execute']) | undefined);
|
|
16
|
+
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
|
17
|
+
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
|
|
18
|
+
values(placeholderValues?: Record<string, unknown> | undefined): Promise<T['values']>;
|
|
19
|
+
}
|
|
20
|
+
interface NeonSessionOptions {
|
|
21
|
+
logger?: Logger;
|
|
22
|
+
}
|
|
23
|
+
declare class NeonSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<NeonQueryResultHKT, TFullSchema, TSchema> {
|
|
24
|
+
private client;
|
|
25
|
+
private schema;
|
|
26
|
+
private options;
|
|
27
|
+
private logger;
|
|
28
|
+
constructor(client: NeonClient, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: NeonSessionOptions);
|
|
29
|
+
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQuery<T>;
|
|
30
|
+
query(query: string, params: unknown[]): Promise<QueryResult>;
|
|
31
|
+
queryObjects<T extends QueryResultRow>(query: string, params: unknown[]): Promise<QueryResult<T>>;
|
|
32
|
+
transaction<T>(transaction: (tx: NeonTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
|
33
|
+
}
|
|
34
|
+
declare class NeonTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<NeonQueryResultHKT, TFullSchema, TSchema> {
|
|
35
|
+
transaction<T>(transaction: (tx: NeonTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
interface NeonQueryResultHKT extends QueryResultHKT {
|
|
38
|
+
type: QueryResult<Assume<this['row'], QueryResultRow>>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface NeonDriverOptions {
|
|
42
|
+
logger?: Logger;
|
|
43
|
+
}
|
|
44
|
+
declare class NeonDriver {
|
|
45
|
+
private client;
|
|
46
|
+
private dialect;
|
|
47
|
+
private options;
|
|
48
|
+
constructor(client: NeonClient, dialect: PgDialect, options?: NeonDriverOptions);
|
|
49
|
+
createSession(schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined): NeonSession<Record<string, unknown>, TablesRelationalConfig>;
|
|
50
|
+
initMappers(): void;
|
|
51
|
+
}
|
|
52
|
+
type NeonDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = PgDatabase<NeonQueryResultHKT, TSchema>;
|
|
53
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: NeonClient, config?: DrizzleConfig<TSchema>): NeonDatabase<TSchema>;
|
|
54
|
+
|
|
55
|
+
export { NeonDriverOptions as N, NeonDriver as a, NeonDatabase as b, NeonClient as c, drizzle as d, NeonPreparedQuery as e, NeonSessionOptions as f, NeonSession as g, NeonTransaction as h, NeonQueryResultHKT as i };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RunResult, Database } from 'better-sqlite3';
|
|
2
|
+
import { B as BaseSQLiteDatabase } from './db.d-a2311092.js';
|
|
3
|
+
import { aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
4
|
+
|
|
5
|
+
type BetterSQLite3Database<TSchema extends Record<string, unknown> = Record<string, never>> = BaseSQLiteDatabase<'sync', RunResult, TSchema>;
|
|
6
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: Database, config?: DrizzleConfig<TSchema>): BetterSQLite3Database<TSchema>;
|
|
7
|
+
|
|
8
|
+
export { BetterSQLite3Database as B, drizzle as d };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Sql, RowList, Row, TransactionSql } from 'postgres';
|
|
2
|
+
import { P as PreparedQueryConfig, a as PreparedQuery, S as SelectedFieldsOrdered, b as PgSession, c as PgDialect, d as PgTransactionConfig, e as PgTransaction, Q as QueryResultHKT, f as PgDatabase } from './db.d-bc9a1d6c.js';
|
|
3
|
+
import { L as Logger, H as Query, ax as Assume, aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
4
|
+
import { J as TablesRelationalConfig, K as RelationalSchemaConfig } from './query-promise.d-e370e0a9.js';
|
|
5
|
+
|
|
6
|
+
declare class PostgresJsPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
|
|
7
|
+
private client;
|
|
8
|
+
private query;
|
|
9
|
+
private params;
|
|
10
|
+
private logger;
|
|
11
|
+
private fields;
|
|
12
|
+
private customResultMapper?;
|
|
13
|
+
constructor(client: Sql, query: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, customResultMapper?: ((rows: unknown[][]) => T['execute']) | undefined);
|
|
14
|
+
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
|
15
|
+
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
|
|
16
|
+
values(placeholderValues?: Record<string, unknown> | undefined): Promise<T['values']>;
|
|
17
|
+
}
|
|
18
|
+
interface PostgresJsSessionOptions {
|
|
19
|
+
logger?: Logger;
|
|
20
|
+
}
|
|
21
|
+
declare class PostgresJsSession<TSQL extends Sql, TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<PostgresJsQueryResultHKT, TFullSchema, TSchema> {
|
|
22
|
+
client: TSQL;
|
|
23
|
+
private schema;
|
|
24
|
+
logger: Logger;
|
|
25
|
+
constructor(client: TSQL, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined,
|
|
26
|
+
/** @internal */
|
|
27
|
+
options?: PostgresJsSessionOptions);
|
|
28
|
+
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQuery<T>;
|
|
29
|
+
query(query: string, params: unknown[]): Promise<RowList<Row[]>>;
|
|
30
|
+
queryObjects<T extends Row>(query: string, params: unknown[]): Promise<RowList<T[]>>;
|
|
31
|
+
transaction<T>(transaction: (tx: PostgresJsTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig): Promise<T>;
|
|
32
|
+
}
|
|
33
|
+
declare class PostgresJsTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<PostgresJsQueryResultHKT, TFullSchema, TSchema> {
|
|
34
|
+
constructor(dialect: PgDialect,
|
|
35
|
+
/** @internal */
|
|
36
|
+
session: PostgresJsSession<TransactionSql, TFullSchema, TSchema>, schema: RelationalSchemaConfig<TSchema> | undefined, nestedIndex?: number);
|
|
37
|
+
transaction<T>(transaction: (tx: PostgresJsTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
38
|
+
}
|
|
39
|
+
interface PostgresJsQueryResultHKT extends QueryResultHKT {
|
|
40
|
+
type: RowList<Assume<this['row'], Row>[]>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type PostgresJsDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = PgDatabase<PostgresJsQueryResultHKT, TSchema>;
|
|
44
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: Sql, config?: DrizzleConfig<TSchema>): PostgresJsDatabase<TSchema>;
|
|
45
|
+
|
|
46
|
+
export { PostgresJsDatabase as P, PostgresJsPreparedQuery as a, PostgresJsSessionOptions as b, PostgresJsSession as c, drizzle as d, PostgresJsTransaction as e, PostgresJsQueryResultHKT as f };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { L as Logger, H as Query, ax as Assume, aH as DrizzleConfig } from './column.d-c31e7ad3.js';
|
|
2
|
+
import { P as PreparedQueryConfig, a as PreparedQuery, S as SelectedFieldsOrdered, b as PgSession, c as PgDialect, d as PgTransactionConfig, e as PgTransaction, Q as QueryResultHKT, f as PgDatabase } from './db.d-bc9a1d6c.js';
|
|
3
|
+
import { J as TablesRelationalConfig, K as RelationalSchemaConfig } from './query-promise.d-e370e0a9.js';
|
|
4
|
+
import pg, { PoolClient, Client, QueryResult, QueryResultRow } from 'pg';
|
|
5
|
+
|
|
6
|
+
type NodePgClient = pg.Pool | PoolClient | Client;
|
|
7
|
+
declare class NodePgPreparedQuery<T extends PreparedQueryConfig> extends PreparedQuery<T> {
|
|
8
|
+
private client;
|
|
9
|
+
private params;
|
|
10
|
+
private logger;
|
|
11
|
+
private fields;
|
|
12
|
+
private customResultMapper?;
|
|
13
|
+
private rawQuery;
|
|
14
|
+
private query;
|
|
15
|
+
constructor(client: NodePgClient, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, name: string | undefined, customResultMapper?: ((rows: unknown[][]) => T['execute']) | undefined);
|
|
16
|
+
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
|
17
|
+
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
|
|
18
|
+
values(placeholderValues?: Record<string, unknown> | undefined): Promise<T['values']>;
|
|
19
|
+
}
|
|
20
|
+
interface NodePgSessionOptions {
|
|
21
|
+
logger?: Logger;
|
|
22
|
+
}
|
|
23
|
+
declare class NodePgSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgSession<NodePgQueryResultHKT, TFullSchema, TSchema> {
|
|
24
|
+
private client;
|
|
25
|
+
private schema;
|
|
26
|
+
private options;
|
|
27
|
+
private logger;
|
|
28
|
+
constructor(client: NodePgClient, dialect: PgDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: NodePgSessionOptions);
|
|
29
|
+
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, customResultMapper?: (rows: unknown[][]) => T['execute']): PreparedQuery<T>;
|
|
30
|
+
query(query: string, params: unknown[]): Promise<QueryResult>;
|
|
31
|
+
queryObjects<T extends QueryResultRow>(query: string, params: unknown[]): Promise<QueryResult<T>>;
|
|
32
|
+
transaction<T>(transaction: (tx: NodePgTransaction<TFullSchema, TSchema>) => Promise<T>, config?: PgTransactionConfig | undefined): Promise<T>;
|
|
33
|
+
}
|
|
34
|
+
declare class NodePgTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends PgTransaction<NodePgQueryResultHKT, TFullSchema, TSchema> {
|
|
35
|
+
transaction<T>(transaction: (tx: NodePgTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
|
36
|
+
}
|
|
37
|
+
interface NodePgQueryResultHKT extends QueryResultHKT {
|
|
38
|
+
type: QueryResult<Assume<this['row'], QueryResultRow>>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface PgDriverOptions {
|
|
42
|
+
logger?: Logger;
|
|
43
|
+
}
|
|
44
|
+
declare class NodePgDriver {
|
|
45
|
+
private client;
|
|
46
|
+
private dialect;
|
|
47
|
+
private options;
|
|
48
|
+
constructor(client: NodePgClient, dialect: PgDialect, options?: PgDriverOptions);
|
|
49
|
+
createSession(schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined): NodePgSession<Record<string, unknown>, TablesRelationalConfig>;
|
|
50
|
+
initMappers(): void;
|
|
51
|
+
}
|
|
52
|
+
type NodePgDatabase<TSchema extends Record<string, unknown> = Record<string, never>> = PgDatabase<NodePgQueryResultHKT, TSchema>;
|
|
53
|
+
declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>>(client: NodePgClient, config?: DrizzleConfig<TSchema>): NodePgDatabase<TSchema>;
|
|
54
|
+
|
|
55
|
+
export { NodePgDriver as N, PgDriverOptions as P, NodePgDatabase as a, NodePgClient as b, NodePgPreparedQuery as c, drizzle as d, NodePgSessionOptions as e, NodePgSession as f, NodePgTransaction as g, NodePgQueryResultHKT as h };
|