pqb 0.53.0 → 0.54.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/dist/index.d.ts +137 -182
- package/dist/index.js +5378 -5429
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5378 -5424
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -249,7 +249,7 @@ type UnionKind = 'UNION' | 'UNION ALL' | 'INTERSECT' | 'INTERSECT ALL' | 'EXCEPT
|
|
|
249
249
|
type OnConflictTarget = string | string[] | Expression | {
|
|
250
250
|
constraint: string;
|
|
251
251
|
};
|
|
252
|
-
type OnConflictSet = RecordUnknown
|
|
252
|
+
type OnConflictSet$1 = RecordUnknown;
|
|
253
253
|
type OnConflictMerge = string | string[] | {
|
|
254
254
|
except: string | string[];
|
|
255
255
|
};
|
|
@@ -351,6 +351,7 @@ interface QueryDataJoinTo extends PickQueryTable, PickQueryQ {
|
|
|
351
351
|
interface HandleResult {
|
|
352
352
|
(q: Query, returnType: QueryReturnType, result: QueryResult, isSubQuery?: true): MaybePromise<unknown>;
|
|
353
353
|
}
|
|
354
|
+
type WithItems = (WithItem | undefined)[];
|
|
354
355
|
interface CommonQueryData {
|
|
355
356
|
adapter: Adapter;
|
|
356
357
|
shape: ColumnsShape;
|
|
@@ -361,7 +362,10 @@ interface CommonQueryData {
|
|
|
361
362
|
returningMany?: boolean;
|
|
362
363
|
wrapInTransaction?: boolean;
|
|
363
364
|
throwOnNotFound?: boolean;
|
|
364
|
-
with?:
|
|
365
|
+
with?: WithItems;
|
|
366
|
+
insertWith?: {
|
|
367
|
+
[rowIndex: number]: WithItems;
|
|
368
|
+
};
|
|
365
369
|
withShapes?: WithConfigs;
|
|
366
370
|
joinTo?: QueryDataJoinTo;
|
|
367
371
|
joinedShapes?: JoinedShapes;
|
|
@@ -478,19 +482,19 @@ interface SelectQueryData extends CommonQueryData {
|
|
|
478
482
|
mode?: 'NO WAIT' | 'SKIP LOCKED';
|
|
479
483
|
};
|
|
480
484
|
}
|
|
481
|
-
type CreateKind = 'object' | '
|
|
485
|
+
type CreateKind = 'object' | 'from';
|
|
482
486
|
interface InsertQueryData extends CommonQueryData {
|
|
483
487
|
type: 'insert';
|
|
484
488
|
kind: CreateKind;
|
|
485
489
|
columns: string[];
|
|
486
|
-
values: unknown[][] |
|
|
490
|
+
values: unknown[][] | {
|
|
487
491
|
from: Query;
|
|
488
492
|
values?: unknown[][];
|
|
489
493
|
};
|
|
490
494
|
join?: JoinItem[];
|
|
491
495
|
onConflict?: {
|
|
492
496
|
target?: OnConflictTarget;
|
|
493
|
-
set?: OnConflictSet;
|
|
497
|
+
set?: OnConflictSet$1;
|
|
494
498
|
merge?: OnConflictMerge;
|
|
495
499
|
};
|
|
496
500
|
}
|
|
@@ -503,7 +507,7 @@ interface UpdateQueryDataObject {
|
|
|
503
507
|
interface UpdatedAtDataInjector {
|
|
504
508
|
(data: UpdateQueryDataItem[]): UpdateQueryDataItem | void;
|
|
505
509
|
}
|
|
506
|
-
type UpdateQueryDataItem = UpdateQueryDataObject |
|
|
510
|
+
type UpdateQueryDataItem = UpdateQueryDataObject | UpdatedAtDataInjector;
|
|
507
511
|
interface UpdateQueryData extends CommonQueryData {
|
|
508
512
|
type: 'update';
|
|
509
513
|
updateData: UpdateQueryDataItem[];
|
|
@@ -3815,19 +3819,19 @@ interface DbResult<ColumnTypes> extends Db<string, never, never, never, never, n
|
|
|
3815
3819
|
declare const createDb: <SchemaConfig extends ColumnSchemaConfig<ColumnTypeBase<orchid_core.ColumnTypeSchemaArg, unknown, any, any, unknown, unknown, any, unknown, any, orchid_core.ColumnDataBase>> = DefaultSchemaConfig, ColumnTypes = DefaultColumnTypes<SchemaConfig>>({ log, logger, snakeCase, schemaConfig, columnTypes: ctOrFn, ...options }: DbOptions<SchemaConfig, ColumnTypes>) => DbResult<ColumnTypes>;
|
|
3816
3820
|
declare const _initQueryBuilder: (adapter: Adapter, columnTypes: unknown, transactionStorage: AsyncLocalStorage<TransactionState>, commonOptions: DbTableOptions<unknown, undefined, QueryColumns>, options: DbSharedOptions) => Db;
|
|
3817
3821
|
|
|
3818
|
-
interface
|
|
3822
|
+
interface ToSqlOptionsInternal extends ToSQLOptions {
|
|
3823
|
+
aliasValue?: true;
|
|
3824
|
+
skipBatchCheck?: true;
|
|
3825
|
+
}
|
|
3826
|
+
interface ToSQLCtx extends ToSqlOptionsInternal {
|
|
3819
3827
|
qb: QueryBuilder;
|
|
3820
3828
|
q: QueryData;
|
|
3821
3829
|
sql: string[];
|
|
3822
3830
|
values: unknown[];
|
|
3823
|
-
aliasValue?: true;
|
|
3824
3831
|
}
|
|
3825
3832
|
interface ToSQLOptions {
|
|
3826
3833
|
values?: unknown[];
|
|
3827
3834
|
}
|
|
3828
|
-
interface ToSqlOptionsInternal extends ToSQLOptions {
|
|
3829
|
-
aliasValue?: true;
|
|
3830
|
-
}
|
|
3831
3835
|
interface ToSQLQuery {
|
|
3832
3836
|
__isQuery: Query['__isQuery'];
|
|
3833
3837
|
q: Query['q'];
|
|
@@ -3867,7 +3871,6 @@ declare const getQueryAs: (q: {
|
|
|
3867
3871
|
as?: string;
|
|
3868
3872
|
};
|
|
3869
3873
|
}) => string;
|
|
3870
|
-
declare const makeRegexToFindInSql: (value: string) => RegExp;
|
|
3871
3874
|
/**
|
|
3872
3875
|
* In `select`, `update`, `create` it's possible to pass a callback with a sub-query.
|
|
3873
3876
|
* This function resolves such a sub-query.
|
|
@@ -4391,7 +4394,7 @@ type CreateDataWithDefaultsForRelations<T extends CreateSelf, Defaults extends k
|
|
|
4391
4394
|
} & {
|
|
4392
4395
|
[K in Defaults as K extends OmitFKeys ? never : K]?: CreateColumn<T, K>;
|
|
4393
4396
|
};
|
|
4394
|
-
type CreateColumn<T extends CreateSelf, K extends keyof T['inputType']> = T['inputType'][K] |
|
|
4397
|
+
type CreateColumn<T extends CreateSelf, K extends keyof T['inputType']> = T['inputType'][K] | ((q: T) => QueryOrExpression<T['inputType'][K]>);
|
|
4395
4398
|
type CreateRelationsData<T extends CreateSelf, BelongsToData> = CreateDataWithDefaultsForRelations<T, keyof T['meta']['defaults'], T['relations'][keyof T['relations']]['omitForeignKeyInCreate']> & ([BelongsToData] extends [never] ? EmptyObject : BelongsToData) & T['relations'][keyof T['relations']]['optionalDataForCreate'];
|
|
4396
4399
|
type CreateBelongsToData<T extends CreateSelf> = [
|
|
4397
4400
|
T['relations'][keyof T['relations']]['dataForCreate']
|
|
@@ -4414,11 +4417,11 @@ type InsertRawOrFromResult<T extends CreateSelf> = T['meta']['hasSelect'] extend
|
|
|
4414
4417
|
type CreateManyResult<T extends CreateSelf, BT> = T extends {
|
|
4415
4418
|
isCount: true;
|
|
4416
4419
|
} ? SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>>;
|
|
4417
|
-
type
|
|
4420
|
+
type CreateManyFromResult<T extends CreateSelf> = T extends {
|
|
4418
4421
|
isCount: true;
|
|
4419
4422
|
} ? SetQueryKind<T, 'create'> : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKind<T, 'create'> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKind<T, 'create'> : SetQueryKind<T, 'create'>;
|
|
4420
4423
|
type InsertManyResult<T extends CreateSelf, BT> = T['meta']['hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKindResult<T, 'create', NarrowCreateResult<T, BT>> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryKindResult<T, 'create', NarrowCreateResult<T, BT>> : SetQueryReturnsRowCountMany<T, 'create'>;
|
|
4421
|
-
type
|
|
4424
|
+
type InsertManyFromResult<T extends CreateSelf> = T['meta']['hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKind<T, 'create'> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKind<T, 'create'> : SetQueryKind<T, 'create'> : SetQueryReturnsRowCountMany<T, 'create'>;
|
|
4422
4425
|
/**
|
|
4423
4426
|
* When creating a record with a *belongs to* nested record,
|
|
4424
4427
|
* un-nullify foreign key columns of the result.
|
|
@@ -4433,22 +4436,6 @@ type NarrowCreateResult<T extends CreateSelf, Bt> = EmptyObject extends T['relat
|
|
|
4433
4436
|
[K in keyof T['result']]: K extends T['relations'][keyof T['relations']]['omitForeignKeyInCreate'] ? QueryColumn<Exclude<T['result'][K]['type'], null>, T['result'][K]['operators']> : T['result'][K];
|
|
4434
4437
|
};
|
|
4435
4438
|
type IgnoreResult<T extends CreateSelf> = T['returnType'] extends 'oneOrThrow' ? QueryTakeOptional<T> : T['returnType'] extends 'valueOrThrow' ? SetQueryReturnsColumnOptional<T, T['result']['value']> : T;
|
|
4436
|
-
interface CreateRawData<T extends CreateSelf> {
|
|
4437
|
-
columns: (keyof T['shape'])[];
|
|
4438
|
-
values: Expression;
|
|
4439
|
-
}
|
|
4440
|
-
interface CreateManyRawData<T extends CreateSelf> {
|
|
4441
|
-
columns: (keyof T['shape'])[];
|
|
4442
|
-
values: Expression[];
|
|
4443
|
-
}
|
|
4444
|
-
type RawRequiredColumns<T extends CreateSelf> = {
|
|
4445
|
-
[K in keyof T['inputType'] as K extends keyof T['meta']['defaults'] ? never : null | undefined extends T['inputType'][K] ? never : K]: true;
|
|
4446
|
-
};
|
|
4447
|
-
type CreateRawArgs<T extends CreateSelf, Arg extends {
|
|
4448
|
-
columns: (keyof T['shape'])[];
|
|
4449
|
-
}> = keyof RawRequiredColumns<T> extends Arg['columns'][number] ? [data: Arg] : [
|
|
4450
|
-
`Missing required columns: ${Exclude<keyof RawRequiredColumns<T> & string, Arg['columns'][number]>}`
|
|
4451
|
-
];
|
|
4452
4439
|
type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression | {
|
|
4453
4440
|
constraint: T['internal']['uniqueConstraints'];
|
|
4454
4441
|
};
|
|
@@ -4470,28 +4457,24 @@ declare const _queryCreate: <T extends CreateSelf, BT extends CreateBelongsToDat
|
|
|
4470
4457
|
declare const _queryInsert: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>) => InsertResult<T, BT>;
|
|
4471
4458
|
declare const _queryCreateMany: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>[]) => CreateManyResult<T, BT>;
|
|
4472
4459
|
declare const _queryInsertMany: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>[]) => InsertManyResult<T, BT>;
|
|
4473
|
-
declare const _queryCreateRaw: <T extends CreateSelf>(q: T, args: CreateRawArgs<T, CreateRawData<T>>) => CreateRawOrFromResult<T>;
|
|
4474
|
-
declare const _queryInsertRaw: <T extends CreateSelf>(q: T, args: CreateRawArgs<T, CreateRawData<T>>) => InsertRawOrFromResult<T>;
|
|
4475
|
-
declare const _queryCreateManyRaw: <T extends CreateSelf>(q: T, args: CreateRawArgs<T, CreateManyRawData<T>>) => CreateManyRawOrFromResult<T>;
|
|
4476
|
-
declare const _queryInsertManyRaw: <T extends CreateSelf>(q: T, args: CreateRawArgs<T, CreateManyRawData<T>>) => InsertManyRawOrFromResult<T>;
|
|
4477
4460
|
interface QueryReturningOne extends IsQuery {
|
|
4478
4461
|
result: QueryColumns;
|
|
4479
4462
|
returnType: 'one' | 'oneOrThrow';
|
|
4480
4463
|
}
|
|
4481
4464
|
declare const _queryCreateFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>) => CreateRawOrFromResult<T>;
|
|
4482
4465
|
declare const _queryInsertFrom: <T extends CreateSelf, Q extends QueryReturningOne>(q: T, query: Q, data?: Omit<CreateData<T, CreateBelongsToData<T>>, keyof Q['result']>) => InsertRawOrFromResult<T>;
|
|
4483
|
-
declare const _queryCreateManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) =>
|
|
4484
|
-
declare const _queryInsertManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) =>
|
|
4466
|
+
declare const _queryCreateManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) => CreateManyFromResult<T>;
|
|
4467
|
+
declare const _queryInsertManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) => InsertManyFromResult<T>;
|
|
4485
4468
|
declare const _queryDefaults: <T extends CreateSelf, Data extends Partial<CreateData<T, CreateBelongsToData<T>>>>(q: T, data: Data) => AddQueryDefaults<T, { [K in keyof Data]: true; }>;
|
|
4486
4469
|
/**
|
|
4487
4470
|
* Names of all create methods,
|
|
4488
4471
|
* is used in {@link RelationQuery} to remove these methods if chained relation shouldn't have them,
|
|
4489
4472
|
* for the case of has one/many through.
|
|
4490
4473
|
*/
|
|
4491
|
-
type CreateMethodsNames = 'create' | 'insert' | 'createMany' | 'insertMany' | '
|
|
4474
|
+
type CreateMethodsNames = 'create' | 'insert' | 'createMany' | 'insertMany' | 'createFrom' | 'insertFrom' | 'createManyFrom' | 'insertManyFrom';
|
|
4492
4475
|
declare class Create {
|
|
4493
4476
|
/**
|
|
4494
|
-
* `create` and `insert`
|
|
4477
|
+
* `create` and `insert` create a single record.
|
|
4495
4478
|
*
|
|
4496
4479
|
* Each column may accept a specific value, a raw SQL, or a query that returns a single value.
|
|
4497
4480
|
*
|
|
@@ -4513,11 +4496,15 @@ declare class Create {
|
|
|
4513
4496
|
*
|
|
4514
4497
|
* // query that returns a single value
|
|
4515
4498
|
* // returning multiple values will result in Postgres error
|
|
4516
|
-
* column2: db.otherTable.get('someColumn'),
|
|
4499
|
+
* column2: () => db.otherTable.get('someColumn'),
|
|
4500
|
+
*
|
|
4501
|
+
* // nesting creates, updates, deletes produces a single SQL
|
|
4502
|
+
* column4: () => db.otherTable.create(data).get('someColumn'),
|
|
4503
|
+
* column5: (q) => q.relatedTable.find(id).update(data).get('someColumn'),
|
|
4517
4504
|
* });
|
|
4518
4505
|
* ```
|
|
4519
4506
|
*
|
|
4520
|
-
*
|
|
4507
|
+
* Creational methods can be used in {@link WithMethods.with} expressions:
|
|
4521
4508
|
*
|
|
4522
4509
|
* ```ts
|
|
4523
4510
|
* db.$qb
|
|
@@ -4559,8 +4546,17 @@ declare class Create {
|
|
|
4559
4546
|
* const createdCount = await db.table.insertMany([data, data, data]);
|
|
4560
4547
|
* ```
|
|
4561
4548
|
*
|
|
4549
|
+
* When nesting creates, a separate create query will be executed for every time it's used:
|
|
4550
|
+
*
|
|
4551
|
+
* ```ts
|
|
4552
|
+
* // will be performed twice, even though it is defined once
|
|
4553
|
+
* const nestedCreate = db.otherTable.create(data).get('column');
|
|
4554
|
+
*
|
|
4555
|
+
* await db.table.createMany([{ column: nestedCreate }, { column: nestedCreate }]);
|
|
4556
|
+
* ```
|
|
4557
|
+
*
|
|
4562
4558
|
* Because of a limitation of Postgres protocol, queries having more than **65535** of values are going to fail in runtime.
|
|
4563
|
-
* To solve this seamlessly, OrchidORM will automatically batch such queries, and wrap them into a transaction, unless they are already in a transaction.
|
|
4559
|
+
* To solve this seamlessly, `OrchidORM` will automatically batch such queries, and wrap them into a transaction, unless they are already in a transaction.
|
|
4564
4560
|
*
|
|
4565
4561
|
* ```ts
|
|
4566
4562
|
* // OK: executes 2 inserts wrapped into a transaction
|
|
@@ -4581,56 +4577,6 @@ declare class Create {
|
|
|
4581
4577
|
* @param data - array of records data, may have values, raw SQL, queries, relation operations
|
|
4582
4578
|
*/
|
|
4583
4579
|
insertMany<T extends CreateSelf, BT extends CreateBelongsToData<T>>(this: T, data: CreateData<T, BT>[]): InsertManyResult<T, BT>;
|
|
4584
|
-
/**
|
|
4585
|
-
* `createRaw` and `insertRaw` are for creating one record with a raw SQL expression.
|
|
4586
|
-
*
|
|
4587
|
-
* Provided SQL will be wrapped into parens for a single `VALUES` record.
|
|
4588
|
-
*
|
|
4589
|
-
* If the table has a column with runtime defaults (defined with callbacks), the value will be appended to your SQL.
|
|
4590
|
-
*
|
|
4591
|
-
* `columns` are type-checked to contain all required columns.
|
|
4592
|
-
*
|
|
4593
|
-
* ```ts
|
|
4594
|
-
* const oneRecord = await db.table.createRaw({
|
|
4595
|
-
* columns: ['name', 'amount'],
|
|
4596
|
-
* values: sql`'name', random()`,
|
|
4597
|
-
* });
|
|
4598
|
-
* ```
|
|
4599
|
-
*
|
|
4600
|
-
* @param args - object with columns list and raw SQL for values
|
|
4601
|
-
*/
|
|
4602
|
-
createRaw<T extends CreateSelf>(this: T, ...args: CreateRawArgs<T, CreateRawData<T>>): CreateRawOrFromResult<T>;
|
|
4603
|
-
/**
|
|
4604
|
-
* Works exactly as {@link createRaw}, except that it returns inserted row count by default.
|
|
4605
|
-
*
|
|
4606
|
-
* @param args - object with columns list and raw SQL for values
|
|
4607
|
-
*/
|
|
4608
|
-
insertRaw<T extends CreateSelf>(this: T, ...args: CreateRawArgs<T, CreateRawData<T>>): InsertRawOrFromResult<T>;
|
|
4609
|
-
/**
|
|
4610
|
-
* `createManyRaw` and `insertManyRaw` are for creating many record with raw SQL expressions.
|
|
4611
|
-
*
|
|
4612
|
-
* Takes array of SQL expressions, each of them will be wrapped into parens for `VALUES` records.
|
|
4613
|
-
*
|
|
4614
|
-
* If the table has a column with runtime defaults (defined with callbacks), function will be called for each SQL and the value will be appended.
|
|
4615
|
-
*
|
|
4616
|
-
* `columns` are type-checked to contain all required columns.
|
|
4617
|
-
*
|
|
4618
|
-
* ```ts
|
|
4619
|
-
* const manyRecords = await db.table.createManyRaw({
|
|
4620
|
-
* columns: ['name', 'amount'],
|
|
4621
|
-
* values: [sql`'one', 2`, sql`'three', 4`],
|
|
4622
|
-
* });
|
|
4623
|
-
* ```
|
|
4624
|
-
*
|
|
4625
|
-
* @param args - object with columns list and array of raw SQL for values
|
|
4626
|
-
*/
|
|
4627
|
-
createManyRaw<T extends CreateSelf>(this: T, ...args: CreateRawArgs<T, CreateManyRawData<T>>): CreateManyRawOrFromResult<T>;
|
|
4628
|
-
/**
|
|
4629
|
-
* Works exactly as {@link createManyRaw}, except that it returns inserted row count by default.
|
|
4630
|
-
*
|
|
4631
|
-
* @param args - object with columns list and array of raw SQL for values
|
|
4632
|
-
*/
|
|
4633
|
-
insertManyRaw<T extends CreateSelf>(this: T, ...args: CreateRawArgs<T, CreateManyRawData<T>>): InsertManyRawOrFromResult<T>;
|
|
4634
4580
|
/**
|
|
4635
4581
|
* These methods are for creating a single record, for batch creating see {@link createManyFrom}.
|
|
4636
4582
|
*
|
|
@@ -4652,6 +4598,10 @@ declare class Create {
|
|
|
4652
4598
|
* // optional argument:
|
|
4653
4599
|
* {
|
|
4654
4600
|
* key: 'value',
|
|
4601
|
+
* // supports sql, nested select, create, update, delete queries
|
|
4602
|
+
* fromSql: () => sql`custom sql`,
|
|
4603
|
+
* fromQuery: () => db.otherTable.find(id).update(data).get('column'),
|
|
4604
|
+
* fromRelated: (q) => q.relatedTable.create(data).get('column'),
|
|
4655
4605
|
* },
|
|
4656
4606
|
* );
|
|
4657
4607
|
* ```
|
|
@@ -4691,13 +4641,13 @@ declare class Create {
|
|
|
4691
4641
|
*
|
|
4692
4642
|
* @param query - query to create new records from
|
|
4693
4643
|
*/
|
|
4694
|
-
createManyFrom<T extends CreateSelf>(this: T, query: IsQuery):
|
|
4644
|
+
createManyFrom<T extends CreateSelf>(this: T, query: IsQuery): CreateManyFromResult<T>;
|
|
4695
4645
|
/**
|
|
4696
4646
|
* Works exactly as {@link createManyFrom}, except that it returns inserted row count by default.
|
|
4697
4647
|
*
|
|
4698
4648
|
* @param query - query to create new records from
|
|
4699
4649
|
*/
|
|
4700
|
-
insertManyFrom<T extends CreateSelf>(this: T, query: IsQuery):
|
|
4650
|
+
insertManyFrom<T extends CreateSelf>(this: T, query: IsQuery): InsertManyFromResult<T>;
|
|
4701
4651
|
/**
|
|
4702
4652
|
* `defaults` allows setting values that will be used later in `create`.
|
|
4703
4653
|
*
|
|
@@ -4869,6 +4819,9 @@ declare class Create {
|
|
|
4869
4819
|
*/
|
|
4870
4820
|
onConflictDoNothing<T extends CreateSelf, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): IgnoreResult<T>;
|
|
4871
4821
|
}
|
|
4822
|
+
type OnConflictSet<T extends CreateSelf> = {
|
|
4823
|
+
[K in keyof T['inputType']]?: T['inputType'][K] | (() => QueryOrExpression<T['inputType'][K]>);
|
|
4824
|
+
};
|
|
4872
4825
|
declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflictArg<T> | undefined> {
|
|
4873
4826
|
private query;
|
|
4874
4827
|
private onConflict;
|
|
@@ -4879,30 +4832,21 @@ declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflic
|
|
|
4879
4832
|
* Updates the record with a given data when conflict occurs.
|
|
4880
4833
|
*
|
|
4881
4834
|
* ```ts
|
|
4882
|
-
* db.table.create(data).onConflict('column').set({
|
|
4883
|
-
* description: 'setting different data on conflict',
|
|
4884
|
-
* });
|
|
4885
|
-
* ```
|
|
4886
|
-
*
|
|
4887
|
-
* The `set` can take a raw SQL expression:
|
|
4888
|
-
*
|
|
4889
|
-
* ```ts
|
|
4890
|
-
* db.table
|
|
4891
|
-
* .create(data)
|
|
4892
|
-
* .onConflict()
|
|
4893
|
-
* .set(sql`raw SQL expression`);
|
|
4894
|
-
*
|
|
4895
|
-
* // update records only on certain conditions
|
|
4896
4835
|
* db.table
|
|
4897
4836
|
* .create(data)
|
|
4898
4837
|
* .onConflict('email')
|
|
4899
|
-
* .set({
|
|
4838
|
+
* .set({
|
|
4839
|
+
* // supports plain values and SQL expressions
|
|
4840
|
+
* key: 'value',
|
|
4841
|
+
* fromSql: () => sql`custom sql`,
|
|
4842
|
+
* })
|
|
4843
|
+
* // to update records only on certain conditions
|
|
4900
4844
|
* .where({ ...certainConditions });
|
|
4901
4845
|
* ```
|
|
4902
4846
|
*
|
|
4903
|
-
* @param set - object containing new column values
|
|
4847
|
+
* @param set - object containing new column values
|
|
4904
4848
|
*/
|
|
4905
|
-
set(set:
|
|
4849
|
+
set(set: OnConflictSet<T>): T;
|
|
4906
4850
|
/**
|
|
4907
4851
|
* Available only after `onConflict`.
|
|
4908
4852
|
*
|
|
@@ -5987,6 +5931,7 @@ type WithSqlResult<T extends PickQueryWithDataColumnTypes, Name extends string,
|
|
|
5987
5931
|
} : K extends keyof T['withData'] ? T['withData'][K] : never;
|
|
5988
5932
|
} : T[K];
|
|
5989
5933
|
};
|
|
5934
|
+
declare const moveQueryValueToWith: (q: Query, withStore: object, value: Query, set: RecordUnknown, key: string, withKey: string | number) => void;
|
|
5990
5935
|
declare class WithMethods {
|
|
5991
5936
|
/**
|
|
5992
5937
|
* Use `with` to add a Common Table Expression (CTE) to the query.
|
|
@@ -6326,7 +6271,6 @@ type UpdateColumn<T extends UpdateSelf, Key extends keyof T['inputType']> = T['i
|
|
|
6326
6271
|
}) => QueryOrExpression<T['inputType'][Key]>);
|
|
6327
6272
|
type UpdateRelationData<T extends UpdateSelf, Rel extends RelationConfigBase> = T['returnType'] extends undefined | 'all' ? Rel['dataForUpdate'] : Rel['dataForUpdateOne'];
|
|
6328
6273
|
type UpdateArg<T extends UpdateSelf> = T['meta']['hasWhere'] extends true ? UpdateData<T> : never;
|
|
6329
|
-
type UpdateRawArgs<T extends UpdateSelf> = T['meta']['hasWhere'] extends true ? SQLQueryArgs : never;
|
|
6330
6274
|
type UpdateResult<T extends UpdateSelf> = T['meta']['hasSelect'] extends true ? SetQueryKind<T, 'update'> : T['returnType'] extends undefined | 'all' ? SetQueryReturnsRowCountMany<T, 'update'> : SetQueryReturnsRowCount<T, 'update'>;
|
|
6331
6275
|
type NumericColumns<T extends PickQueryShape> = {
|
|
6332
6276
|
[K in keyof T['shape']]: Exclude<T['shape'][K]['queryType'], string> extends number | bigint | null ? K : never;
|
|
@@ -6344,7 +6288,6 @@ interface UpdateCtxCollect {
|
|
|
6344
6288
|
}
|
|
6345
6289
|
declare const _queryChangeCounter: <T extends UpdateSelf>(self: T, op: string, data: ChangeCountArg<T>) => never;
|
|
6346
6290
|
declare const _queryUpdate: <T extends UpdateSelf>(query: T, arg: UpdateArg<T>) => UpdateResult<T>;
|
|
6347
|
-
declare const _queryUpdateRaw: <T extends UpdateSelf>(q: T, sql: Expression) => UpdateResult<T>;
|
|
6348
6291
|
declare const _queryUpdateOrThrow: <T extends UpdateSelf>(q: T, arg: UpdateArg<T>) => UpdateResult<T>;
|
|
6349
6292
|
declare class Update {
|
|
6350
6293
|
/**
|
|
@@ -6399,14 +6342,14 @@ declare class Update {
|
|
|
6399
6342
|
*
|
|
6400
6343
|
* await db.table.where({ ...conditions }).update({
|
|
6401
6344
|
* // set the column to a specific value
|
|
6402
|
-
*
|
|
6345
|
+
* value: 123,
|
|
6403
6346
|
*
|
|
6404
|
-
* // use
|
|
6405
|
-
*
|
|
6347
|
+
* // use custom SQL to update the column
|
|
6348
|
+
* fromSql: () => sql`2 + 2`,
|
|
6406
6349
|
*
|
|
6407
6350
|
* // use query that returns a single value
|
|
6408
6351
|
* // returning multiple values will result in Postgres error
|
|
6409
|
-
*
|
|
6352
|
+
* fromQuery: () => db.otherTable.get('someColumn'),
|
|
6410
6353
|
*
|
|
6411
6354
|
* // select a single value from a related record
|
|
6412
6355
|
* fromRelation: (q) => q.relatedTable.get('someColumn'),
|
|
@@ -6416,9 +6359,48 @@ declare class Update {
|
|
|
6416
6359
|
* });
|
|
6417
6360
|
* ```
|
|
6418
6361
|
*
|
|
6362
|
+
* `update` can be used in [with](/guide/advanced-queries#with) expressions:
|
|
6363
|
+
*
|
|
6364
|
+
* ```ts
|
|
6365
|
+
* db.$qb
|
|
6366
|
+
* // update record in one table
|
|
6367
|
+
* .with('a', db.table.find(1).select('id').update(data))
|
|
6368
|
+
* // update record in other table using the first table record id
|
|
6369
|
+
* .with('b', (q) =>
|
|
6370
|
+
* db.otherTable
|
|
6371
|
+
* .find(1)
|
|
6372
|
+
* .select('id')
|
|
6373
|
+
* .update({
|
|
6374
|
+
* ...otherData,
|
|
6375
|
+
* aId: () => q.from('a').get('id'),
|
|
6376
|
+
* }),
|
|
6377
|
+
* )
|
|
6378
|
+
* .from('b');
|
|
6379
|
+
*
|
|
6380
|
+
* `update` can be used in {@link WithMethods.with} expressions:
|
|
6381
|
+
*
|
|
6382
|
+
* ```ts
|
|
6383
|
+
* db.$qb
|
|
6384
|
+
* // update record in one table
|
|
6385
|
+
* .with('a', db.table.find(1).select('id').update(data))
|
|
6386
|
+
* // update record in other table using the first table record id
|
|
6387
|
+
* .with('b', (q) =>
|
|
6388
|
+
* db.otherTable
|
|
6389
|
+
* .find(1)
|
|
6390
|
+
* .select('id')
|
|
6391
|
+
* .update({
|
|
6392
|
+
* ...otherData,
|
|
6393
|
+
* aId: () => q.from('a').get('id'),
|
|
6394
|
+
* }),
|
|
6395
|
+
* )
|
|
6396
|
+
* .from('b');
|
|
6397
|
+
* ```
|
|
6398
|
+
*
|
|
6419
6399
|
* ### sub-queries
|
|
6420
6400
|
*
|
|
6421
|
-
* In
|
|
6401
|
+
* In all `create`, `update`, `upsert` methods,
|
|
6402
|
+
* you can use sub queries that are either selecting a single value,
|
|
6403
|
+
* or creating/updating/deleting a record and return a single value.
|
|
6422
6404
|
*
|
|
6423
6405
|
* ```ts
|
|
6424
6406
|
* await db.table.where({ ...conditions }).update({
|
|
@@ -6426,16 +6408,18 @@ declare class Update {
|
|
|
6426
6408
|
* column: () => db.otherTable.get('otherColumn').create({ ...data }),
|
|
6427
6409
|
*
|
|
6428
6410
|
* // `column2` will be set to a value of the `otherColumn` of the updated record.
|
|
6429
|
-
* column2: () =>
|
|
6430
|
-
* .
|
|
6431
|
-
*
|
|
6432
|
-
*
|
|
6411
|
+
* column2: () =>
|
|
6412
|
+
* db.otherTable
|
|
6413
|
+
* .get('otherColumn')
|
|
6414
|
+
* .findBy({ ...conditions })
|
|
6415
|
+
* .update({ key: 'value' }),
|
|
6433
6416
|
*
|
|
6434
6417
|
* // `column3` will be set to a value of the `otherColumn` of the deleted record.
|
|
6435
|
-
* column3: () =>
|
|
6436
|
-
* .
|
|
6437
|
-
*
|
|
6438
|
-
*
|
|
6418
|
+
* column3: () =>
|
|
6419
|
+
* db.otherTable
|
|
6420
|
+
* .get('otherColumn')
|
|
6421
|
+
* .findBy({ ...conditions })
|
|
6422
|
+
* .delete(),
|
|
6439
6423
|
* });
|
|
6440
6424
|
* ```
|
|
6441
6425
|
*
|
|
@@ -6447,47 +6431,25 @@ declare class Update {
|
|
|
6447
6431
|
* VALUES ('val1', 'val2', 'val3')
|
|
6448
6432
|
* RETURNING "otherTable"."selectedColumn"
|
|
6449
6433
|
* )
|
|
6434
|
+
* -- In a case of create
|
|
6435
|
+
* INSERT INTO "table"("column") VALUES ((SELECT * FROM "q"))
|
|
6436
|
+
* -- In a case of update
|
|
6450
6437
|
* UPDATE "table"
|
|
6451
6438
|
* SET "column" = (SELECT * FROM "q")
|
|
6452
6439
|
* ```
|
|
6453
6440
|
*
|
|
6454
|
-
* The query is atomic
|
|
6441
|
+
* The query is atomic.
|
|
6442
|
+
* No changes will persist in the database if the sub-query fails, or if the top-level query fails, or if multiple rows are returned from a sub-query.
|
|
6455
6443
|
*
|
|
6456
|
-
*
|
|
6457
|
-
*
|
|
6458
|
-
* ```ts
|
|
6459
|
-
* await db.table.find(1).update({
|
|
6460
|
-
* // update column `one` with the value of column `two` of the related record.
|
|
6461
|
-
* one: (q) => q.relatedTable.get('two'),
|
|
6462
|
-
* })
|
|
6463
|
-
* ```
|
|
6444
|
+
* [//]: # 'not supported in create because cannot query related records for a thing that is not created yet'
|
|
6445
|
+
* [//]: # 'modificational sub queries are not allowed in update because it would be too hard to join a with statement to the update query'
|
|
6464
6446
|
*
|
|
6465
|
-
*
|
|
6447
|
+
* Only selective sub-queries are supported in `update` queries when the sub-query is using a relation:
|
|
6466
6448
|
*
|
|
6467
6449
|
* ```ts
|
|
6468
|
-
*
|
|
6469
|
-
*
|
|
6470
|
-
*
|
|
6471
|
-
* })
|
|
6472
|
-
* ```
|
|
6473
|
-
*
|
|
6474
|
-
* `update` can be used in {@link WithMethods.with} expressions:
|
|
6475
|
-
*
|
|
6476
|
-
* ```ts
|
|
6477
|
-
* db.$qb
|
|
6478
|
-
* // update record in one table
|
|
6479
|
-
* .with('a', db.table.find(1).select('id').update(data))
|
|
6480
|
-
* // update record in other table using the first table record id
|
|
6481
|
-
* .with('b', (q) =>
|
|
6482
|
-
* db.otherTable
|
|
6483
|
-
* .find(1)
|
|
6484
|
-
* .select('id')
|
|
6485
|
-
* .update({
|
|
6486
|
-
* ...otherData,
|
|
6487
|
-
* aId: () => q.from('a').get('id'),
|
|
6488
|
-
* }),
|
|
6489
|
-
* )
|
|
6490
|
-
* .from('b');
|
|
6450
|
+
* db.book.update({
|
|
6451
|
+
* authorName: (q) => q.author.get('name'),
|
|
6452
|
+
* });
|
|
6491
6453
|
* ```
|
|
6492
6454
|
*
|
|
6493
6455
|
* ### null, undefined, unknown columns
|
|
@@ -6527,26 +6489,6 @@ declare class Update {
|
|
|
6527
6489
|
* @param arg - data to update records with, may have specific values, raw SQL, queries, or callbacks with sub-queries.
|
|
6528
6490
|
*/
|
|
6529
6491
|
update<T extends UpdateSelf>(this: T, arg: UpdateArg<T>): UpdateResult<T>;
|
|
6530
|
-
/**
|
|
6531
|
-
* `updateSql` is for updating records with raw expression.
|
|
6532
|
-
*
|
|
6533
|
-
* The behavior is the same as a regular `update` method has:
|
|
6534
|
-
* `find` or `where` must precede calling this method,
|
|
6535
|
-
* it returns an updated count by default,
|
|
6536
|
-
* you can customize returning data by using `select`.
|
|
6537
|
-
*
|
|
6538
|
-
* ```ts
|
|
6539
|
-
* const value = 'new name';
|
|
6540
|
-
*
|
|
6541
|
-
* // update with SQL template string
|
|
6542
|
-
* const updatedCount = await db.table.find(1).updateSql`name = ${value}`;
|
|
6543
|
-
*
|
|
6544
|
-
* // or update with `sql` function:
|
|
6545
|
-
* await db.table.find(1).updateSql(sql`name = ${value}`);
|
|
6546
|
-
* ```
|
|
6547
|
-
* @param args - raw SQL via a template string or by using a `sql` method
|
|
6548
|
-
*/
|
|
6549
|
-
updateSql<T extends UpdateSelf>(this: T, ...args: UpdateRawArgs<T>): UpdateResult<T>;
|
|
6550
6492
|
/**
|
|
6551
6493
|
* To make sure that at least one row was updated use `updateOrThrow`:
|
|
6552
6494
|
*
|
|
@@ -6993,6 +6935,14 @@ declare class QueryUpsertOrCreate {
|
|
|
6993
6935
|
* data: {
|
|
6994
6936
|
* // update record's name
|
|
6995
6937
|
* name: 'new name',
|
|
6938
|
+
* // supports sql and nested queries
|
|
6939
|
+
* fromSQL: () => sql`*SQL expression*`,
|
|
6940
|
+
* fromQuery: () => db.someTable.create(data).get('column'),
|
|
6941
|
+
* },
|
|
6942
|
+
* create: {
|
|
6943
|
+
* // create a new record with this email and a name 'new name'
|
|
6944
|
+
* email: 'some@email.com',
|
|
6945
|
+
* // supports sql and nested queries as well
|
|
6996
6946
|
* },
|
|
6997
6947
|
* create: {
|
|
6998
6948
|
* // create a new record with this email and a name 'new name'
|
|
@@ -7083,11 +7033,16 @@ declare class QueryUpsertOrCreate {
|
|
|
7083
7033
|
* No result is returned by default, place `get`, `select`, or `selectAll` before `orCreate` to specify returning columns.
|
|
7084
7034
|
*
|
|
7085
7035
|
* ```ts
|
|
7086
|
-
* const user = await
|
|
7036
|
+
* const user = await db.user
|
|
7037
|
+
* .selectAll()
|
|
7087
7038
|
* .findBy({ email: 'some@email.com' })
|
|
7088
7039
|
* .orCreate({
|
|
7089
7040
|
* email: 'some@email.com',
|
|
7090
7041
|
* name: 'created user',
|
|
7042
|
+
* // supports sql and nested queries
|
|
7043
|
+
* fromSQL: () => sql`*SQL expression*`,
|
|
7044
|
+
* fromQuery: () => db.someTable.create(data).get('column'),
|
|
7045
|
+
* fromRelated: (q) => q.relatedTable.update(data).get('column'),
|
|
7091
7046
|
* });
|
|
7092
7047
|
* ```
|
|
7093
7048
|
*
|
|
@@ -8903,7 +8858,7 @@ declare const setQueryObjectValueImmutable: <T extends PickQueryQ>(q: T, object:
|
|
|
8903
8858
|
*/
|
|
8904
8859
|
declare const throwIfNoWhere: (q: PickQueryQ, method: string) => void;
|
|
8905
8860
|
declare const throwIfJoinLateral: (q: PickQueryQ, method: string) => void;
|
|
8906
|
-
declare const
|
|
8861
|
+
declare const saveAliasedShape: (q: IsQuery, as: string, key: 'joinedShapes' | 'withShapes') => string;
|
|
8907
8862
|
/**
|
|
8908
8863
|
* Extend query prototype with new methods.
|
|
8909
8864
|
* The query and its data are cloned (with Object.create).
|
|
@@ -9047,4 +9002,4 @@ type CopyResult<T extends PickQueryMeta> = SetQueryKind<T, 'copy'>;
|
|
|
9047
9002
|
*/
|
|
9048
9003
|
declare function copyTableData<T extends PickQueryMetaShape>(query: T, arg: CopyArg<T>): CopyResult<T>;
|
|
9049
9004
|
|
|
9050
|
-
export { Adapter, type AdapterConfig, type AdapterOptions, type AddQueryDefaults, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterHook, type AggregateArgTypes, AggregateMethods, type AggregateOptions, type AliasOrTable, ArrayColumn, type ArrayColumnValue, type ArrayData, AsMethods, type AsQueryArg, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, type BooleanQueryColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, Clear, type ClearStatement, type ColumnData, type ColumnDataGenerated, type ColumnFromDbParams, type ColumnInfoQueryData, ColumnRefExpression, ColumnType, type ColumnsByType, type ColumnsShape, type ColumnsShapeToNullableObject, type ColumnsShapeToObject, type ColumnsShapeToObjectArray, type ColumnsShapeToPluck, type CommonQueryData, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CopyOptions, type CopyQueryData, Create, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateKind, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteQueryData, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, type ExpressionOutput, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, For, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratedColumn, type GeneratorIgnore, type GetArg, type GetColumnInfo, type GetResult, type GetResultOptional, type GetStringArg, type GroupArgs, type HandleResult, Having, type HavingItem, type HookAction, type HookSelectArg, type IdentityColumn, InetColumn, type InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsolationLevel, JSONColumn, JSONTextColumn, Join, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultRequireMain, type JoinedParsers, type JoinedShapes, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet, type OnConflictTarget, OnMethods, type Operator, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, OrchidOrmError, OrchidOrmInternalError, type OrderArg, type OrderArgSelf, type OrderArgs, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickColumnData, type PickQueryBaseQuery, type PickQueryColumnTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryInternal, type PickQueryMetaColumnTypes, type PickQueryMetaRelations, type PickQueryMetaRelationsResult, type PickQueryMetaRelationsResultReturnType, type PickQueryMetaRelationsReturnType, type PickQueryMetaResultRelations, type PickQueryMetaResultRelationsWindows, type PickQueryMetaResultRelationsWindowsColumnTypes, type PickQueryMetaResultRelationsWithDataReturnType, type PickQueryMetaResultRelationsWithDataReturnTypeShape, type PickQueryMetaResultReturnTypeWithDataWindows, type PickQueryMetaResultReturnTypeWithDataWindowsThen, type PickQueryMetaShapeRelationsReturnType, type PickQueryMetaShapeRelationsWithData, type PickQueryMetaTable, type PickQueryMetaTableShape, type PickQueryMetaTableShapeReturnTypeWithData, type PickQueryMetaWithData, type PickQueryMetaWithDataColumnTypes, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, type PickQueryRelationQueries, type PickQueryRelations, type PickQueryRelationsWithData, type PickQueryResultColumnTypes, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTableMetaResultReturnTypeWithDataWindowsThen, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type Queries, type Query, type QueryAfterHook, type QueryArraysResult, type QueryBatchResult, type QueryBeforeHook, type QueryBuilder, type QueryComputedArg, type QueryData, type QueryDataFromItem, type QueryDataJoinTo, type QueryDefaultReturnData, QueryError, type QueryErrorName, QueryGet, type QueryGetSelf, type QueryHelperResult, QueryHooks, type QueryIfResultThen, type QueryInternal, QueryLog, type QueryMetaHasSelect, type QueryMetaHasWhere, QueryMethods, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryScopeData, type QueryScopes, type QuerySourceItem, type QueryTake, type QueryTakeOptional, QueryUpsertOrCreate, RawSQL, RealColumn, type RecordOfColumnsShapeBase, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RuntimeComputedQueryColumn, type SearchArg, SearchMethods, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsValue, type SelectItem, type SelectQueryData, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryKind, type SetQueryKindResult, type SetQueryReturnsAll, type SetQueryReturnsAllKind, type SetQueryReturnsAllKindResult, type SetQueryReturnsColumnInfo, type SetQueryReturnsColumnKind, type SetQueryReturnsColumnKindResult, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsOneKind, type SetQueryReturnsOneKindResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumn, type SetQueryReturnsPluckColumnKind, type SetQueryReturnsPluckColumnKindResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsVoid, type SetQueryReturnsVoidKind, type SetQueryTableAlias, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, SmallIntColumn, SmallSerialColumn, type SortDir, type SqlFn, SqlMethod, StringColumn$1 as StringColumn, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, TimestampColumn, TimestampTZColumn, type ToSQLCtx, type ToSQLOptions, type ToSQLQuery, Transaction, TransactionAdapter, type TransactionOptions, TransformMethods, type TruncateQueryData, TsQueryColumn, TsVectorColumn, type TypeParsers, UUIDColumn, UnhandledTypeError, Union, type UnionArgs, type UnionItem, type UnionKind, type UnionSet, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, type UpsertResult, type UpsertThis, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereResult, type WhereSearchItem, type WhereSearchResult, type WindowArg, type WindowArgDeclaration, type WindowDeclaration, type WindowItem, type WithArgsOptions, type WithConfigs, type WithDataItem, type WithDataItems, type WithItem, WithMethods, type WithOptions, type WithQueryBuilder, type WithRecursiveOptions, type WithResult, type WithSqlResult, type WrapQueryArg, XMLColumn, _clone, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryAs, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateManyRaw, _queryCreateRaw, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertManyRaw, _queryInsertRaw, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryResolveAlias, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryUpdateRaw, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, assignDbDataToColumn, checkIfASimpleQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDb, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnBaseType, getColumnInfo, getColumnTypes, getFullColumnTable, getPrimaryKeys, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, isDefaultTimeStamp, isInUserTransaction, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, makeRegexToFindInSql, parseRecord, parseTableData, parseTableDataInput, performQuery, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallbackV2, rollbackSql, saveSearchAlias, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setParserForSelectedString, setQueryObjectValueImmutable, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, toSQL };
|
|
9005
|
+
export { Adapter, type AdapterConfig, type AdapterOptions, type AddQueryDefaults, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterHook, type AggregateArgTypes, AggregateMethods, type AggregateOptions, type AliasOrTable, ArrayColumn, type ArrayColumnValue, type ArrayData, AsMethods, type AsQueryArg, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, type BooleanQueryColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, Clear, type ClearStatement, type ColumnData, type ColumnDataGenerated, type ColumnFromDbParams, type ColumnInfoQueryData, ColumnRefExpression, ColumnType, type ColumnsByType, type ColumnsShape, type ColumnsShapeToNullableObject, type ColumnsShapeToObject, type ColumnsShapeToObjectArray, type ColumnsShapeToPluck, type CommonQueryData, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CopyOptions, type CopyQueryData, Create, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateKind, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteQueryData, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, type ExpressionOutput, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, For, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratedColumn, type GeneratorIgnore, type GetArg, type GetColumnInfo, type GetResult, type GetResultOptional, type GetStringArg, type GroupArgs, type HandleResult, Having, type HavingItem, type HookAction, type HookSelectArg, type IdentityColumn, InetColumn, type InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsolationLevel, JSONColumn, JSONTextColumn, Join, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultRequireMain, type JoinedParsers, type JoinedShapes, JsonMethods, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet$1 as OnConflictSet, type OnConflictTarget, OnMethods, type Operator, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, OrchidOrmError, OrchidOrmInternalError, type OrderArg, type OrderArgSelf, type OrderArgs, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickColumnData, type PickQueryBaseQuery, type PickQueryColumnTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryInternal, type PickQueryMetaColumnTypes, type PickQueryMetaRelations, type PickQueryMetaRelationsResult, type PickQueryMetaRelationsResultReturnType, type PickQueryMetaRelationsReturnType, type PickQueryMetaResultRelations, type PickQueryMetaResultRelationsWindows, type PickQueryMetaResultRelationsWindowsColumnTypes, type PickQueryMetaResultRelationsWithDataReturnType, type PickQueryMetaResultRelationsWithDataReturnTypeShape, type PickQueryMetaResultReturnTypeWithDataWindows, type PickQueryMetaResultReturnTypeWithDataWindowsThen, type PickQueryMetaShapeRelationsReturnType, type PickQueryMetaShapeRelationsWithData, type PickQueryMetaTable, type PickQueryMetaTableShape, type PickQueryMetaTableShapeReturnTypeWithData, type PickQueryMetaWithData, type PickQueryMetaWithDataColumnTypes, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, type PickQueryRelationQueries, type PickQueryRelations, type PickQueryRelationsWithData, type PickQueryResultColumnTypes, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTableMetaResultReturnTypeWithDataWindowsThen, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type Queries, type Query, type QueryAfterHook, type QueryArraysResult, type QueryBatchResult, type QueryBeforeHook, type QueryBuilder, type QueryComputedArg, type QueryData, type QueryDataFromItem, type QueryDataJoinTo, type QueryDefaultReturnData, QueryError, type QueryErrorName, QueryGet, type QueryGetSelf, type QueryHelperResult, QueryHooks, type QueryIfResultThen, type QueryInternal, QueryLog, type QueryMetaHasSelect, type QueryMetaHasWhere, QueryMethods, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryScopeData, type QueryScopes, type QuerySourceItem, type QueryTake, type QueryTakeOptional, QueryUpsertOrCreate, RawSQL, RealColumn, type RecordOfColumnsShapeBase, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RuntimeComputedQueryColumn, type SearchArg, SearchMethods, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsValue, type SelectItem, type SelectQueryData, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryKind, type SetQueryKindResult, type SetQueryReturnsAll, type SetQueryReturnsAllKind, type SetQueryReturnsAllKindResult, type SetQueryReturnsColumnInfo, type SetQueryReturnsColumnKind, type SetQueryReturnsColumnKindResult, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsOneKind, type SetQueryReturnsOneKindResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumn, type SetQueryReturnsPluckColumnKind, type SetQueryReturnsPluckColumnKindResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsVoid, type SetQueryReturnsVoidKind, type SetQueryTableAlias, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, SmallIntColumn, SmallSerialColumn, type SortDir, type SqlFn, SqlMethod, StringColumn$1 as StringColumn, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, TimestampColumn, TimestampTZColumn, type ToSQLCtx, type ToSQLOptions, type ToSQLQuery, Transaction, TransactionAdapter, type TransactionOptions, TransformMethods, type TruncateQueryData, TsQueryColumn, TsVectorColumn, type TypeParsers, UUIDColumn, UnhandledTypeError, Union, type UnionArgs, type UnionItem, type UnionKind, type UnionSet, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, type UpsertResult, type UpsertThis, VarCharColumn, VirtualColumn, Where, type WhereArg, type WhereArgs, type WhereInArg, type WhereInColumn, type WhereInItem, type WhereInValues, type WhereItem, type WhereJsonPathEqualsItem, type WhereNotArgs, type WhereOnItem, type WhereOnJoinItem, type WhereQueryBuilder, type WhereResult, type WhereSearchItem, type WhereSearchResult, type WindowArg, type WindowArgDeclaration, type WindowDeclaration, type WindowItem, type WithArgsOptions, type WithConfigs, type WithDataItem, type WithDataItems, type WithItem, type WithItems, WithMethods, type WithOptions, type WithQueryBuilder, type WithRecursiveOptions, type WithResult, type WithSqlResult, type WrapQueryArg, XMLColumn, _clone, _getSelectableColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryAs, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryResolveAlias, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, applyComputedColumns, assignDbDataToColumn, checkIfASimpleQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, commitSql, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDb, defaultSchemaConfig, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, extendQuery, filterResult, foreignKeyArgumentToCode, getClonedQueryData, getColumnBaseType, getColumnInfo, getColumnTypes, getFullColumnTable, getPrimaryKeys, getQueryAs, getShapeFromSelect, getSqlText, handleResult, identityToCode, indexInnerToCode, indexToCode, isDefaultTimeStamp, isInUserTransaction, isQueryReturnsAll, isSelectingCount, joinSubQuery, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, moveQueryValueToWith, parseRecord, parseTableData, parseTableDataInput, performQuery, postgisTypmodToSql, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processSelectArg, pushLimitSQL, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, raw, referencesArgsToCode, resolveSubQueryCallbackV2, rollbackSql, saveAliasedShape, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setParserForSelectedString, setQueryObjectValueImmutable, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, toSQL };
|