pqb 0.53.0 → 0.54.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +160 -196
- package/dist/index.js +5691 -5571
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5690 -5566
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PoolConfig, Pool, PoolClient } from 'pg';
|
|
2
2
|
import * as orchid_core from 'orchid-core';
|
|
3
|
-
import { QueryResultRow, AdapterConfigBase, AdapterBase, QueryInput, SingleSqlItem, Sql, IsQuery, PickQueryTableMetaResult, PickQueryShape, PickQueryTable, PickQueryMetaReturnType, RecordUnknown, Expression, MaybeArray, ColumnTypesBase, TemplateLiteralArgs, QueryColumn, EmptyObject, QueryColumns, MaybePromise, FnUnknownToUnknown, QueryMetaBase, QueryReturnType, RecordString, ColumnsShapeBase, ColumnsParsers, HookSelect, BatchParsers, QueryLogObject, QueryLogger, QueryDataTransform, ExpressionChain, ColumnSchemaConfig, RawSQLBase, RawSQLValues, ExpressionTypeMethod, DynamicSQLArg, ExpressionData, StaticSQLArgs, SQLQueryArgs, EmptyTuple, PickQueryMeta, PickQueryMetaResultReturnType, QueryColumnToNullable, QueryThenByQuery, ColumnShapeInput, SelectableBase, PickQueryMetaShape, PickQueryTableMetaResultShape, PickQueryMetaResultWindows, PickOutputTypeAndOperators, PickQueryResult, ValExpression, PickOutputType, QueryThen, DateColumnData, ColumnToCodeCtx, Code, TimeInterval, ColumnTypeSchemaArg, ColumnDataBase, ArrayMethodsData, ForeignKeyTable, ColumnNameOfTable, BaseNumberData, PickColumnBaseData, ColumnWithDefault, StringTypeData, PrimaryKeyColumn, ColumnTypeBase, ParseColumn, ParseNullColumn, EncodeColumn, QueryColumnsInit, QueryLogOptions, DefaultSelectColumns, DefaultSelectOutput, QueryThenShallowSimplifyArr, QueryCatch, TransactionState, QueryColumnOfDataType, PickQueryUniqueProperties, PickQueryMetaResult, PickQueryTableMetaResultInputType, UnionToIntersection, AfterCommitStandaloneHook, getValueKey, QueryThenByReturnType, QueryMetaIsSubQuery, PickQueryReturnType, QueryReturnTypeAll, QueryReturnTypeOptional, QueryThenShallowSimplifyOptional, QueryThenShallowSimplify, PickQueryResultReturnType, PickQueryResultReturnTypeUniqueColumns, PickQueryTableMetaShape, QueryInternalBase, PickType, RecordKeyTrue, ColumnShapeOutput, OperatorsNullable, UniqueColumn, TimestampHelpers, ShallowSimplify, Codes, ColumnDataCheckBase } from 'orchid-core';
|
|
3
|
+
import { QueryResultRow, AdapterConfigBase, AdapterBase, QueryInput, SingleSqlItem, Sql, IsQuery, PickQueryTableMetaResult, PickQueryShape, PickQueryTable, PickQueryMetaReturnType, RecordUnknown, Expression, MaybeArray, ColumnTypesBase, TemplateLiteralArgs, QueryColumn, EmptyObject, QueryColumns, MaybePromise, FnUnknownToUnknown, QueryMetaBase, QueryReturnType, RecordString, ColumnsShapeBase, ColumnsParsers, PickQueryInputType, HookSelect, BatchParsers, QueryLogObject, QueryLogger, QueryDataTransform, ExpressionChain, ColumnSchemaConfig, RawSQLBase, RawSQLValues, ExpressionTypeMethod, DynamicSQLArg, ExpressionData, StaticSQLArgs, SQLQueryArgs, EmptyTuple, PickQueryMeta, PickQueryMetaResultReturnType, QueryColumnToNullable, QueryThenByQuery, ColumnShapeInput, SelectableBase, PickQueryMetaShape, PickQueryTableMetaResultShape, PickQueryMetaResultWindows, PickOutputTypeAndOperators, PickQueryResult, ValExpression, PickOutputType, QueryThen, DateColumnData, ColumnToCodeCtx, Code, TimeInterval, ColumnTypeSchemaArg, ColumnDataBase, ArrayMethodsData, ForeignKeyTable, ColumnNameOfTable, BaseNumberData, PickColumnBaseData, ColumnWithDefault, StringTypeData, PrimaryKeyColumn, ColumnTypeBase, ParseColumn, ParseNullColumn, EncodeColumn, QueryColumnsInit, QueryLogOptions, DefaultSelectColumns, DefaultSelectOutput, QueryThenShallowSimplifyArr, QueryCatch, TransactionState, QueryColumnOfDataType, PickQueryUniqueProperties, PickQueryMetaResult, PickQueryTableMetaResultInputType, UnionToIntersection, AfterCommitStandaloneHook, getValueKey, QueryThenByReturnType, QueryMetaIsSubQuery, PickQueryReturnType, QueryReturnTypeAll, QueryReturnTypeOptional, QueryThenShallowSimplifyOptional, QueryThenShallowSimplify, PickQueryResultReturnType, PickQueryResultReturnTypeUniqueColumns, PickQueryTableMetaShape, QueryInternalBase, PickType, RecordKeyTrue, ColumnShapeOutput, OperatorsNullable, UniqueColumn, TimestampHelpers, ShallowSimplify, Codes, ColumnDataCheckBase } from 'orchid-core';
|
|
4
4
|
import { inspect } from 'node:util';
|
|
5
5
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
6
|
import { QueryResult as QueryResult$1, QueryBuilder as QueryBuilder$1, QueryInternal as QueryInternal$1, Adapter as Adapter$1, QueryData as QueryData$1 } from 'pqb';
|
|
@@ -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
|
};
|
|
@@ -336,7 +336,8 @@ type JoinedShapes = RecordOfColumnsShapeBase;
|
|
|
336
336
|
interface JoinedParsers {
|
|
337
337
|
[K: string]: ColumnsParsers | undefined;
|
|
338
338
|
}
|
|
339
|
-
type
|
|
339
|
+
type QueryBeforeHookInternal = (query: Query) => void | Promise<void>;
|
|
340
|
+
type QueryBeforeHook = (utils: QueryHookUtils<PickQueryInputType>) => void | Promise<void>;
|
|
340
341
|
type QueryAfterHook<Data = unknown> = (data: Data, query: Query) => unknown | Promise<unknown>;
|
|
341
342
|
interface QueryScopes {
|
|
342
343
|
[K: string]: QueryScopeData;
|
|
@@ -351,6 +352,7 @@ interface QueryDataJoinTo extends PickQueryTable, PickQueryQ {
|
|
|
351
352
|
interface HandleResult {
|
|
352
353
|
(q: Query, returnType: QueryReturnType, result: QueryResult, isSubQuery?: true): MaybePromise<unknown>;
|
|
353
354
|
}
|
|
355
|
+
type WithItems = (WithItem | undefined)[];
|
|
354
356
|
interface CommonQueryData {
|
|
355
357
|
adapter: Adapter;
|
|
356
358
|
shape: ColumnsShape;
|
|
@@ -361,7 +363,10 @@ interface CommonQueryData {
|
|
|
361
363
|
returningMany?: boolean;
|
|
362
364
|
wrapInTransaction?: boolean;
|
|
363
365
|
throwOnNotFound?: boolean;
|
|
364
|
-
with?:
|
|
366
|
+
with?: WithItems;
|
|
367
|
+
insertWith?: {
|
|
368
|
+
[rowIndex: number]: WithItems;
|
|
369
|
+
};
|
|
365
370
|
withShapes?: WithConfigs;
|
|
366
371
|
joinTo?: QueryDataJoinTo;
|
|
367
372
|
joinedShapes?: JoinedShapes;
|
|
@@ -411,17 +416,17 @@ interface CommonQueryData {
|
|
|
411
416
|
hookSelect?: HookSelect;
|
|
412
417
|
computeds?: ComputedColumns;
|
|
413
418
|
selectedComputeds?: ComputedColumns;
|
|
414
|
-
before?:
|
|
419
|
+
before?: QueryBeforeHookInternal[];
|
|
415
420
|
after?: QueryAfterHook[];
|
|
416
|
-
beforeCreate?:
|
|
421
|
+
beforeCreate?: QueryBeforeHookInternal[];
|
|
417
422
|
afterCreate?: QueryAfterHook[];
|
|
418
423
|
afterCreateCommit?: QueryAfterHook[];
|
|
419
424
|
afterCreateSelect?: Set<string>;
|
|
420
|
-
beforeUpdate?:
|
|
425
|
+
beforeUpdate?: QueryBeforeHookInternal[];
|
|
421
426
|
afterUpdate?: QueryAfterHook[];
|
|
422
427
|
afterUpdateCommit?: QueryAfterHook[];
|
|
423
428
|
afterUpdateSelect?: Set<string>;
|
|
424
|
-
beforeDelete?:
|
|
429
|
+
beforeDelete?: QueryBeforeHookInternal[];
|
|
425
430
|
afterDelete?: QueryAfterHook[];
|
|
426
431
|
afterDeleteCommit?: QueryAfterHook[];
|
|
427
432
|
afterDeleteSelect?: Set<string>;
|
|
@@ -456,6 +461,8 @@ interface CommonQueryData {
|
|
|
456
461
|
targetHookSelect: HookSelect;
|
|
457
462
|
};
|
|
458
463
|
outerQuery?: Query;
|
|
464
|
+
hookCreateSet?: RecordUnknown[];
|
|
465
|
+
hookUpdateSet?: RecordUnknown[];
|
|
459
466
|
}
|
|
460
467
|
interface SelectQueryData extends CommonQueryData {
|
|
461
468
|
type: undefined | 'upsert';
|
|
@@ -478,22 +485,22 @@ interface SelectQueryData extends CommonQueryData {
|
|
|
478
485
|
mode?: 'NO WAIT' | 'SKIP LOCKED';
|
|
479
486
|
};
|
|
480
487
|
}
|
|
481
|
-
type CreateKind = 'object' | 'raw' | 'from';
|
|
482
488
|
interface InsertQueryData extends CommonQueryData {
|
|
483
489
|
type: 'insert';
|
|
484
|
-
kind: CreateKind;
|
|
485
490
|
columns: string[];
|
|
486
|
-
values:
|
|
487
|
-
from: Query;
|
|
488
|
-
values?: unknown[][];
|
|
489
|
-
};
|
|
491
|
+
values: InsertQueryDataObjectValues | InsertQueryDataFromValues;
|
|
490
492
|
join?: JoinItem[];
|
|
491
493
|
onConflict?: {
|
|
492
494
|
target?: OnConflictTarget;
|
|
493
|
-
set?: OnConflictSet;
|
|
495
|
+
set?: OnConflictSet$1;
|
|
494
496
|
merge?: OnConflictMerge;
|
|
495
497
|
};
|
|
496
498
|
}
|
|
499
|
+
type InsertQueryDataObjectValues = unknown[][];
|
|
500
|
+
type InsertQueryDataFromValues = {
|
|
501
|
+
from: Query;
|
|
502
|
+
values?: unknown[];
|
|
503
|
+
};
|
|
497
504
|
interface UpdateQueryDataObject {
|
|
498
505
|
[K: string]: Expression | {
|
|
499
506
|
op: string;
|
|
@@ -503,7 +510,7 @@ interface UpdateQueryDataObject {
|
|
|
503
510
|
interface UpdatedAtDataInjector {
|
|
504
511
|
(data: UpdateQueryDataItem[]): UpdateQueryDataItem | void;
|
|
505
512
|
}
|
|
506
|
-
type UpdateQueryDataItem = UpdateQueryDataObject |
|
|
513
|
+
type UpdateQueryDataItem = UpdateQueryDataObject | UpdatedAtDataInjector;
|
|
507
514
|
interface UpdateQueryData extends CommonQueryData {
|
|
508
515
|
type: 'update';
|
|
509
516
|
updateData: UpdateQueryDataItem[];
|
|
@@ -3815,19 +3822,19 @@ interface DbResult<ColumnTypes> extends Db<string, never, never, never, never, n
|
|
|
3815
3822
|
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
3823
|
declare const _initQueryBuilder: (adapter: Adapter, columnTypes: unknown, transactionStorage: AsyncLocalStorage<TransactionState>, commonOptions: DbTableOptions<unknown, undefined, QueryColumns>, options: DbSharedOptions) => Db;
|
|
3817
3824
|
|
|
3818
|
-
interface
|
|
3825
|
+
interface ToSqlOptionsInternal extends ToSQLOptions {
|
|
3826
|
+
aliasValue?: true;
|
|
3827
|
+
skipBatchCheck?: true;
|
|
3828
|
+
}
|
|
3829
|
+
interface ToSQLCtx extends ToSqlOptionsInternal {
|
|
3819
3830
|
qb: QueryBuilder;
|
|
3820
3831
|
q: QueryData;
|
|
3821
3832
|
sql: string[];
|
|
3822
3833
|
values: unknown[];
|
|
3823
|
-
aliasValue?: true;
|
|
3824
3834
|
}
|
|
3825
3835
|
interface ToSQLOptions {
|
|
3826
3836
|
values?: unknown[];
|
|
3827
3837
|
}
|
|
3828
|
-
interface ToSqlOptionsInternal extends ToSQLOptions {
|
|
3829
|
-
aliasValue?: true;
|
|
3830
|
-
}
|
|
3831
3838
|
interface ToSQLQuery {
|
|
3832
3839
|
__isQuery: Query['__isQuery'];
|
|
3833
3840
|
q: Query['q'];
|
|
@@ -3867,7 +3874,6 @@ declare const getQueryAs: (q: {
|
|
|
3867
3874
|
as?: string;
|
|
3868
3875
|
};
|
|
3869
3876
|
}) => string;
|
|
3870
|
-
declare const makeRegexToFindInSql: (value: string) => RegExp;
|
|
3871
3877
|
/**
|
|
3872
3878
|
* In `select`, `update`, `create` it's possible to pass a callback with a sub-query.
|
|
3873
3879
|
* This function resolves such a sub-query.
|
|
@@ -4391,7 +4397,7 @@ type CreateDataWithDefaultsForRelations<T extends CreateSelf, Defaults extends k
|
|
|
4391
4397
|
} & {
|
|
4392
4398
|
[K in Defaults as K extends OmitFKeys ? never : K]?: CreateColumn<T, K>;
|
|
4393
4399
|
};
|
|
4394
|
-
type CreateColumn<T extends CreateSelf, K extends keyof T['inputType']> = T['inputType'][K] |
|
|
4400
|
+
type CreateColumn<T extends CreateSelf, K extends keyof T['inputType']> = T['inputType'][K] | ((q: T) => QueryOrExpression<T['inputType'][K]>);
|
|
4395
4401
|
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
4402
|
type CreateBelongsToData<T extends CreateSelf> = [
|
|
4397
4403
|
T['relations'][keyof T['relations']]['dataForCreate']
|
|
@@ -4414,11 +4420,11 @@ type InsertRawOrFromResult<T extends CreateSelf> = T['meta']['hasSelect'] extend
|
|
|
4414
4420
|
type CreateManyResult<T extends CreateSelf, BT> = T extends {
|
|
4415
4421
|
isCount: true;
|
|
4416
4422
|
} ? 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
|
|
4423
|
+
type CreateManyFromResult<T extends CreateSelf> = T extends {
|
|
4418
4424
|
isCount: true;
|
|
4419
4425
|
} ? SetQueryKind<T, 'create'> : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllKind<T, 'create'> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnKind<T, 'create'> : SetQueryKind<T, 'create'>;
|
|
4420
4426
|
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
|
|
4427
|
+
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
4428
|
/**
|
|
4423
4429
|
* When creating a record with a *belongs to* nested record,
|
|
4424
4430
|
* un-nullify foreign key columns of the result.
|
|
@@ -4433,22 +4439,6 @@ type NarrowCreateResult<T extends CreateSelf, Bt> = EmptyObject extends T['relat
|
|
|
4433
4439
|
[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
4440
|
};
|
|
4435
4441
|
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
4442
|
type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression | {
|
|
4453
4443
|
constraint: T['internal']['uniqueConstraints'];
|
|
4454
4444
|
};
|
|
@@ -4470,28 +4460,24 @@ declare const _queryCreate: <T extends CreateSelf, BT extends CreateBelongsToDat
|
|
|
4470
4460
|
declare const _queryInsert: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>) => InsertResult<T, BT>;
|
|
4471
4461
|
declare const _queryCreateMany: <T extends CreateSelf, BT extends CreateBelongsToData<T>>(q: T, data: CreateData<T, BT>[]) => CreateManyResult<T, BT>;
|
|
4472
4462
|
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
4463
|
interface QueryReturningOne extends IsQuery {
|
|
4478
4464
|
result: QueryColumns;
|
|
4479
4465
|
returnType: 'one' | 'oneOrThrow';
|
|
4480
4466
|
}
|
|
4481
4467
|
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
4468
|
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) =>
|
|
4469
|
+
declare const _queryCreateManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) => CreateManyFromResult<T>;
|
|
4470
|
+
declare const _queryInsertManyFrom: <T extends CreateSelf>(q: T, query: IsQuery) => InsertManyFromResult<T>;
|
|
4485
4471
|
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
4472
|
/**
|
|
4487
4473
|
* Names of all create methods,
|
|
4488
4474
|
* is used in {@link RelationQuery} to remove these methods if chained relation shouldn't have them,
|
|
4489
4475
|
* for the case of has one/many through.
|
|
4490
4476
|
*/
|
|
4491
|
-
type CreateMethodsNames = 'create' | 'insert' | 'createMany' | 'insertMany' | '
|
|
4477
|
+
type CreateMethodsNames = 'create' | 'insert' | 'createMany' | 'insertMany' | 'createFrom' | 'insertFrom' | 'createManyFrom' | 'insertManyFrom';
|
|
4492
4478
|
declare class Create {
|
|
4493
4479
|
/**
|
|
4494
|
-
* `create` and `insert`
|
|
4480
|
+
* `create` and `insert` create a single record.
|
|
4495
4481
|
*
|
|
4496
4482
|
* Each column may accept a specific value, a raw SQL, or a query that returns a single value.
|
|
4497
4483
|
*
|
|
@@ -4513,11 +4499,15 @@ declare class Create {
|
|
|
4513
4499
|
*
|
|
4514
4500
|
* // query that returns a single value
|
|
4515
4501
|
* // returning multiple values will result in Postgres error
|
|
4516
|
-
* column2: db.otherTable.get('someColumn'),
|
|
4502
|
+
* column2: () => db.otherTable.get('someColumn'),
|
|
4503
|
+
*
|
|
4504
|
+
* // nesting creates, updates, deletes produces a single SQL
|
|
4505
|
+
* column4: () => db.otherTable.create(data).get('someColumn'),
|
|
4506
|
+
* column5: (q) => q.relatedTable.find(id).update(data).get('someColumn'),
|
|
4517
4507
|
* });
|
|
4518
4508
|
* ```
|
|
4519
4509
|
*
|
|
4520
|
-
*
|
|
4510
|
+
* Creational methods can be used in {@link WithMethods.with} expressions:
|
|
4521
4511
|
*
|
|
4522
4512
|
* ```ts
|
|
4523
4513
|
* db.$qb
|
|
@@ -4559,8 +4549,17 @@ declare class Create {
|
|
|
4559
4549
|
* const createdCount = await db.table.insertMany([data, data, data]);
|
|
4560
4550
|
* ```
|
|
4561
4551
|
*
|
|
4552
|
+
* When nesting creates, a separate create query will be executed for every time it's used:
|
|
4553
|
+
*
|
|
4554
|
+
* ```ts
|
|
4555
|
+
* // will be performed twice, even though it is defined once
|
|
4556
|
+
* const nestedCreate = db.otherTable.create(data).get('column');
|
|
4557
|
+
*
|
|
4558
|
+
* await db.table.createMany([{ column: nestedCreate }, { column: nestedCreate }]);
|
|
4559
|
+
* ```
|
|
4560
|
+
*
|
|
4562
4561
|
* 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.
|
|
4562
|
+
* To solve this seamlessly, `OrchidORM` will automatically batch such queries, and wrap them into a transaction, unless they are already in a transaction.
|
|
4564
4563
|
*
|
|
4565
4564
|
* ```ts
|
|
4566
4565
|
* // OK: executes 2 inserts wrapped into a transaction
|
|
@@ -4581,56 +4580,6 @@ declare class Create {
|
|
|
4581
4580
|
* @param data - array of records data, may have values, raw SQL, queries, relation operations
|
|
4582
4581
|
*/
|
|
4583
4582
|
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
4583
|
/**
|
|
4635
4584
|
* These methods are for creating a single record, for batch creating see {@link createManyFrom}.
|
|
4636
4585
|
*
|
|
@@ -4652,6 +4601,10 @@ declare class Create {
|
|
|
4652
4601
|
* // optional argument:
|
|
4653
4602
|
* {
|
|
4654
4603
|
* key: 'value',
|
|
4604
|
+
* // supports sql, nested select, create, update, delete queries
|
|
4605
|
+
* fromSql: () => sql`custom sql`,
|
|
4606
|
+
* fromQuery: () => db.otherTable.find(id).update(data).get('column'),
|
|
4607
|
+
* fromRelated: (q) => q.relatedTable.create(data).get('column'),
|
|
4655
4608
|
* },
|
|
4656
4609
|
* );
|
|
4657
4610
|
* ```
|
|
@@ -4691,13 +4644,13 @@ declare class Create {
|
|
|
4691
4644
|
*
|
|
4692
4645
|
* @param query - query to create new records from
|
|
4693
4646
|
*/
|
|
4694
|
-
createManyFrom<T extends CreateSelf>(this: T, query: IsQuery):
|
|
4647
|
+
createManyFrom<T extends CreateSelf>(this: T, query: IsQuery): CreateManyFromResult<T>;
|
|
4695
4648
|
/**
|
|
4696
4649
|
* Works exactly as {@link createManyFrom}, except that it returns inserted row count by default.
|
|
4697
4650
|
*
|
|
4698
4651
|
* @param query - query to create new records from
|
|
4699
4652
|
*/
|
|
4700
|
-
insertManyFrom<T extends CreateSelf>(this: T, query: IsQuery):
|
|
4653
|
+
insertManyFrom<T extends CreateSelf>(this: T, query: IsQuery): InsertManyFromResult<T>;
|
|
4701
4654
|
/**
|
|
4702
4655
|
* `defaults` allows setting values that will be used later in `create`.
|
|
4703
4656
|
*
|
|
@@ -4869,6 +4822,9 @@ declare class Create {
|
|
|
4869
4822
|
*/
|
|
4870
4823
|
onConflictDoNothing<T extends CreateSelf, Arg extends OnConflictArg<T>>(this: T, arg?: Arg): IgnoreResult<T>;
|
|
4871
4824
|
}
|
|
4825
|
+
type OnConflictSet<T extends CreateSelf> = {
|
|
4826
|
+
[K in keyof T['inputType']]?: T['inputType'][K] | (() => QueryOrExpression<T['inputType'][K]>);
|
|
4827
|
+
};
|
|
4872
4828
|
declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflictArg<T> | undefined> {
|
|
4873
4829
|
private query;
|
|
4874
4830
|
private onConflict;
|
|
@@ -4879,30 +4835,21 @@ declare class OnConflictQueryBuilder<T extends CreateSelf, Arg extends OnConflic
|
|
|
4879
4835
|
* Updates the record with a given data when conflict occurs.
|
|
4880
4836
|
*
|
|
4881
4837
|
* ```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
4838
|
* db.table
|
|
4897
4839
|
* .create(data)
|
|
4898
4840
|
* .onConflict('email')
|
|
4899
|
-
* .set({
|
|
4841
|
+
* .set({
|
|
4842
|
+
* // supports plain values and SQL expressions
|
|
4843
|
+
* key: 'value',
|
|
4844
|
+
* fromSql: () => sql`custom sql`,
|
|
4845
|
+
* })
|
|
4846
|
+
* // to update records only on certain conditions
|
|
4900
4847
|
* .where({ ...certainConditions });
|
|
4901
4848
|
* ```
|
|
4902
4849
|
*
|
|
4903
|
-
* @param set - object containing new column values
|
|
4850
|
+
* @param set - object containing new column values
|
|
4904
4851
|
*/
|
|
4905
|
-
set(set:
|
|
4852
|
+
set(set: OnConflictSet<T>): T;
|
|
4906
4853
|
/**
|
|
4907
4854
|
* Available only after `onConflict`.
|
|
4908
4855
|
*
|
|
@@ -5452,7 +5399,7 @@ type AfterHook<Select extends PropertyKey[], Shape extends QueryColumns> = Query
|
|
|
5452
5399
|
}[]>;
|
|
5453
5400
|
type HookSelectArg<T extends PickQueryShape> = (keyof T['shape'] & string)[];
|
|
5454
5401
|
type HookAction = 'Create' | 'Update' | 'Delete';
|
|
5455
|
-
declare const _queryHookBeforeQuery: <T extends PickQueryShape>(q: T, cb:
|
|
5402
|
+
declare const _queryHookBeforeQuery: <T extends PickQueryShape>(q: T, cb: QueryBeforeHookInternal) => T;
|
|
5456
5403
|
declare const _queryHookAfterQuery: <T extends PickQueryShape>(q: T, cb: QueryAfterHook) => T;
|
|
5457
5404
|
declare const _queryHookBeforeCreate: <T extends PickQueryShape>(q: T, cb: QueryBeforeHook) => T;
|
|
5458
5405
|
declare const _queryHookAfterCreate: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
@@ -5463,16 +5410,22 @@ declare const _queryHookAfterUpdateCommit: <T extends PickQueryShape, S extends
|
|
|
5463
5410
|
declare const _queryHookBeforeSave: <T extends PickQueryShape>(q: T, cb: QueryBeforeHook) => T;
|
|
5464
5411
|
declare const _queryHookAfterSave: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5465
5412
|
declare const _queryAfterSaveCommit: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5466
|
-
declare const _queryHookBeforeDelete: <T extends PickQueryShape>(q: T, cb:
|
|
5413
|
+
declare const _queryHookBeforeDelete: <T extends PickQueryShape>(q: T, cb: QueryBeforeHookInternal) => T;
|
|
5467
5414
|
declare const _queryHookAfterDelete: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5468
5415
|
declare const _queryHookAfterDeleteCommit: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5416
|
+
declare class QueryHookUtils<T extends PickQueryInputType> {
|
|
5417
|
+
query: Query;
|
|
5418
|
+
private key;
|
|
5419
|
+
constructor(query: Query, key: 'hookCreateSet' | 'hookUpdateSet');
|
|
5420
|
+
set: (data: { [K in keyof T["inputType"]]?: T["inputType"][K] | (() => QueryOrExpression<T["inputType"][K]>) | undefined; }) => void;
|
|
5421
|
+
}
|
|
5469
5422
|
declare abstract class QueryHooks {
|
|
5470
5423
|
/**
|
|
5471
5424
|
* Run the function before any kind of query.
|
|
5472
5425
|
*
|
|
5473
5426
|
* @param cb - function to call, first argument is a query object
|
|
5474
5427
|
*/
|
|
5475
|
-
beforeQuery<T>(this: T, cb:
|
|
5428
|
+
beforeQuery<T>(this: T, cb: QueryBeforeHookInternal): T;
|
|
5476
5429
|
/**
|
|
5477
5430
|
* Run the function after any kind of query.
|
|
5478
5431
|
* Enforces wrapping the query into a transaction.
|
|
@@ -5562,7 +5515,7 @@ declare abstract class QueryHooks {
|
|
|
5562
5515
|
*
|
|
5563
5516
|
* @param cb - function to call, first argument is a query object
|
|
5564
5517
|
*/
|
|
5565
|
-
beforeDelete<T>(this: T, cb:
|
|
5518
|
+
beforeDelete<T>(this: T, cb: QueryBeforeHookInternal): T;
|
|
5566
5519
|
/**
|
|
5567
5520
|
* Run the function after a `delete` kind of query.
|
|
5568
5521
|
* Enforces wrapping the query into a transaction.
|
|
@@ -5987,6 +5940,7 @@ type WithSqlResult<T extends PickQueryWithDataColumnTypes, Name extends string,
|
|
|
5987
5940
|
} : K extends keyof T['withData'] ? T['withData'][K] : never;
|
|
5988
5941
|
} : T[K];
|
|
5989
5942
|
};
|
|
5943
|
+
declare const moveQueryValueToWith: (q: Query, withStore: object, value: Query, set: RecordUnknown, key: string, withKey: string | number) => void;
|
|
5990
5944
|
declare class WithMethods {
|
|
5991
5945
|
/**
|
|
5992
5946
|
* Use `with` to add a Common Table Expression (CTE) to the query.
|
|
@@ -6326,7 +6280,6 @@ type UpdateColumn<T extends UpdateSelf, Key extends keyof T['inputType']> = T['i
|
|
|
6326
6280
|
}) => QueryOrExpression<T['inputType'][Key]>);
|
|
6327
6281
|
type UpdateRelationData<T extends UpdateSelf, Rel extends RelationConfigBase> = T['returnType'] extends undefined | 'all' ? Rel['dataForUpdate'] : Rel['dataForUpdateOne'];
|
|
6328
6282
|
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
6283
|
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
6284
|
type NumericColumns<T extends PickQueryShape> = {
|
|
6332
6285
|
[K in keyof T['shape']]: Exclude<T['shape'][K]['queryType'], string> extends number | bigint | null ? K : never;
|
|
@@ -6344,7 +6297,6 @@ interface UpdateCtxCollect {
|
|
|
6344
6297
|
}
|
|
6345
6298
|
declare const _queryChangeCounter: <T extends UpdateSelf>(self: T, op: string, data: ChangeCountArg<T>) => never;
|
|
6346
6299
|
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
6300
|
declare const _queryUpdateOrThrow: <T extends UpdateSelf>(q: T, arg: UpdateArg<T>) => UpdateResult<T>;
|
|
6349
6301
|
declare class Update {
|
|
6350
6302
|
/**
|
|
@@ -6399,14 +6351,14 @@ declare class Update {
|
|
|
6399
6351
|
*
|
|
6400
6352
|
* await db.table.where({ ...conditions }).update({
|
|
6401
6353
|
* // set the column to a specific value
|
|
6402
|
-
*
|
|
6354
|
+
* value: 123,
|
|
6403
6355
|
*
|
|
6404
|
-
* // use
|
|
6405
|
-
*
|
|
6356
|
+
* // use custom SQL to update the column
|
|
6357
|
+
* fromSql: () => sql`2 + 2`,
|
|
6406
6358
|
*
|
|
6407
6359
|
* // use query that returns a single value
|
|
6408
6360
|
* // returning multiple values will result in Postgres error
|
|
6409
|
-
*
|
|
6361
|
+
* fromQuery: () => db.otherTable.get('someColumn'),
|
|
6410
6362
|
*
|
|
6411
6363
|
* // select a single value from a related record
|
|
6412
6364
|
* fromRelation: (q) => q.relatedTable.get('someColumn'),
|
|
@@ -6416,9 +6368,48 @@ declare class Update {
|
|
|
6416
6368
|
* });
|
|
6417
6369
|
* ```
|
|
6418
6370
|
*
|
|
6371
|
+
* `update` can be used in [with](/guide/advanced-queries#with) expressions:
|
|
6372
|
+
*
|
|
6373
|
+
* ```ts
|
|
6374
|
+
* db.$qb
|
|
6375
|
+
* // update record in one table
|
|
6376
|
+
* .with('a', db.table.find(1).select('id').update(data))
|
|
6377
|
+
* // update record in other table using the first table record id
|
|
6378
|
+
* .with('b', (q) =>
|
|
6379
|
+
* db.otherTable
|
|
6380
|
+
* .find(1)
|
|
6381
|
+
* .select('id')
|
|
6382
|
+
* .update({
|
|
6383
|
+
* ...otherData,
|
|
6384
|
+
* aId: () => q.from('a').get('id'),
|
|
6385
|
+
* }),
|
|
6386
|
+
* )
|
|
6387
|
+
* .from('b');
|
|
6388
|
+
*
|
|
6389
|
+
* `update` can be used in {@link WithMethods.with} expressions:
|
|
6390
|
+
*
|
|
6391
|
+
* ```ts
|
|
6392
|
+
* db.$qb
|
|
6393
|
+
* // update record in one table
|
|
6394
|
+
* .with('a', db.table.find(1).select('id').update(data))
|
|
6395
|
+
* // update record in other table using the first table record id
|
|
6396
|
+
* .with('b', (q) =>
|
|
6397
|
+
* db.otherTable
|
|
6398
|
+
* .find(1)
|
|
6399
|
+
* .select('id')
|
|
6400
|
+
* .update({
|
|
6401
|
+
* ...otherData,
|
|
6402
|
+
* aId: () => q.from('a').get('id'),
|
|
6403
|
+
* }),
|
|
6404
|
+
* )
|
|
6405
|
+
* .from('b');
|
|
6406
|
+
* ```
|
|
6407
|
+
*
|
|
6419
6408
|
* ### sub-queries
|
|
6420
6409
|
*
|
|
6421
|
-
* In
|
|
6410
|
+
* In all `create`, `update`, `upsert` methods,
|
|
6411
|
+
* you can use sub queries that are either selecting a single value,
|
|
6412
|
+
* or creating/updating/deleting a record and return a single value.
|
|
6422
6413
|
*
|
|
6423
6414
|
* ```ts
|
|
6424
6415
|
* await db.table.where({ ...conditions }).update({
|
|
@@ -6426,16 +6417,18 @@ declare class Update {
|
|
|
6426
6417
|
* column: () => db.otherTable.get('otherColumn').create({ ...data }),
|
|
6427
6418
|
*
|
|
6428
6419
|
* // `column2` will be set to a value of the `otherColumn` of the updated record.
|
|
6429
|
-
* column2: () =>
|
|
6430
|
-
* .
|
|
6431
|
-
*
|
|
6432
|
-
*
|
|
6420
|
+
* column2: () =>
|
|
6421
|
+
* db.otherTable
|
|
6422
|
+
* .get('otherColumn')
|
|
6423
|
+
* .findBy({ ...conditions })
|
|
6424
|
+
* .update({ key: 'value' }),
|
|
6433
6425
|
*
|
|
6434
6426
|
* // `column3` will be set to a value of the `otherColumn` of the deleted record.
|
|
6435
|
-
* column3: () =>
|
|
6436
|
-
* .
|
|
6437
|
-
*
|
|
6438
|
-
*
|
|
6427
|
+
* column3: () =>
|
|
6428
|
+
* db.otherTable
|
|
6429
|
+
* .get('otherColumn')
|
|
6430
|
+
* .findBy({ ...conditions })
|
|
6431
|
+
* .delete(),
|
|
6439
6432
|
* });
|
|
6440
6433
|
* ```
|
|
6441
6434
|
*
|
|
@@ -6447,47 +6440,25 @@ declare class Update {
|
|
|
6447
6440
|
* VALUES ('val1', 'val2', 'val3')
|
|
6448
6441
|
* RETURNING "otherTable"."selectedColumn"
|
|
6449
6442
|
* )
|
|
6443
|
+
* -- In a case of create
|
|
6444
|
+
* INSERT INTO "table"("column") VALUES ((SELECT * FROM "q"))
|
|
6445
|
+
* -- In a case of update
|
|
6450
6446
|
* UPDATE "table"
|
|
6451
6447
|
* SET "column" = (SELECT * FROM "q")
|
|
6452
6448
|
* ```
|
|
6453
6449
|
*
|
|
6454
|
-
* The query is atomic
|
|
6455
|
-
*
|
|
6456
|
-
* Though it's possible to select a single value from a callback for the column to update:
|
|
6450
|
+
* The query is atomic.
|
|
6451
|
+
* 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.
|
|
6457
6452
|
*
|
|
6458
|
-
*
|
|
6459
|
-
*
|
|
6460
|
-
* // update column `one` with the value of column `two` of the related record.
|
|
6461
|
-
* one: (q) => q.relatedTable.get('two'),
|
|
6462
|
-
* })
|
|
6463
|
-
* ```
|
|
6453
|
+
* [//]: # 'not supported in create because cannot query related records for a thing that is not created yet'
|
|
6454
|
+
* [//]: # 'modificational sub queries are not allowed in update because it would be too hard to join a with statement to the update query'
|
|
6464
6455
|
*
|
|
6465
|
-
*
|
|
6456
|
+
* Only selective sub-queries are supported in `update` queries when the sub-query is using a relation:
|
|
6466
6457
|
*
|
|
6467
6458
|
* ```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');
|
|
6459
|
+
* db.book.update({
|
|
6460
|
+
* authorName: (q) => q.author.get('name'),
|
|
6461
|
+
* });
|
|
6491
6462
|
* ```
|
|
6492
6463
|
*
|
|
6493
6464
|
* ### null, undefined, unknown columns
|
|
@@ -6527,26 +6498,6 @@ declare class Update {
|
|
|
6527
6498
|
* @param arg - data to update records with, may have specific values, raw SQL, queries, or callbacks with sub-queries.
|
|
6528
6499
|
*/
|
|
6529
6500
|
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
6501
|
/**
|
|
6551
6502
|
* To make sure that at least one row was updated use `updateOrThrow`:
|
|
6552
6503
|
*
|
|
@@ -6993,6 +6944,14 @@ declare class QueryUpsertOrCreate {
|
|
|
6993
6944
|
* data: {
|
|
6994
6945
|
* // update record's name
|
|
6995
6946
|
* name: 'new name',
|
|
6947
|
+
* // supports sql and nested queries
|
|
6948
|
+
* fromSQL: () => sql`*SQL expression*`,
|
|
6949
|
+
* fromQuery: () => db.someTable.create(data).get('column'),
|
|
6950
|
+
* },
|
|
6951
|
+
* create: {
|
|
6952
|
+
* // create a new record with this email and a name 'new name'
|
|
6953
|
+
* email: 'some@email.com',
|
|
6954
|
+
* // supports sql and nested queries as well
|
|
6996
6955
|
* },
|
|
6997
6956
|
* create: {
|
|
6998
6957
|
* // create a new record with this email and a name 'new name'
|
|
@@ -7083,11 +7042,16 @@ declare class QueryUpsertOrCreate {
|
|
|
7083
7042
|
* No result is returned by default, place `get`, `select`, or `selectAll` before `orCreate` to specify returning columns.
|
|
7084
7043
|
*
|
|
7085
7044
|
* ```ts
|
|
7086
|
-
* const user = await
|
|
7045
|
+
* const user = await db.user
|
|
7046
|
+
* .selectAll()
|
|
7087
7047
|
* .findBy({ email: 'some@email.com' })
|
|
7088
7048
|
* .orCreate({
|
|
7089
7049
|
* email: 'some@email.com',
|
|
7090
7050
|
* name: 'created user',
|
|
7051
|
+
* // supports sql and nested queries
|
|
7052
|
+
* fromSQL: () => sql`*SQL expression*`,
|
|
7053
|
+
* fromQuery: () => db.someTable.create(data).get('column'),
|
|
7054
|
+
* fromRelated: (q) => q.relatedTable.update(data).get('column'),
|
|
7091
7055
|
* });
|
|
7092
7056
|
* ```
|
|
7093
7057
|
*
|
|
@@ -8903,7 +8867,7 @@ declare const setQueryObjectValueImmutable: <T extends PickQueryQ>(q: T, object:
|
|
|
8903
8867
|
*/
|
|
8904
8868
|
declare const throwIfNoWhere: (q: PickQueryQ, method: string) => void;
|
|
8905
8869
|
declare const throwIfJoinLateral: (q: PickQueryQ, method: string) => void;
|
|
8906
|
-
declare const
|
|
8870
|
+
declare const saveAliasedShape: (q: IsQuery, as: string, key: 'joinedShapes' | 'withShapes') => string;
|
|
8907
8871
|
/**
|
|
8908
8872
|
* Extend query prototype with new methods.
|
|
8909
8873
|
* The query and its data are cloned (with Object.create).
|
|
@@ -9047,4 +9011,4 @@ type CopyResult<T extends PickQueryMeta> = SetQueryKind<T, 'copy'>;
|
|
|
9047
9011
|
*/
|
|
9048
9012
|
declare function copyTableData<T extends PickQueryMetaShape>(query: T, arg: CopyArg<T>): CopyResult<T>;
|
|
9049
9013
|
|
|
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 };
|
|
9014
|
+
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 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, type InsertQueryDataFromValues, type InsertQueryDataObjectValues, 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 QueryBeforeHookInternal, type QueryBuilder, type QueryComputedArg, type QueryData, type QueryDataFromItem, type QueryDataJoinTo, type QueryDefaultReturnData, QueryError, type QueryErrorName, QueryGet, type QueryGetSelf, type QueryHelperResult, QueryHookUtils, 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 };
|