pqb 0.54.0 → 0.54.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +105 -109
- package/dist/index.js +380 -323
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +349 -291
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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, QueryOrExpression, QueryColumn, EmptyObject, QueryColumns, MaybePromise, FnUnknownToUnknown, QueryMetaBase, QueryReturnType, RecordString, ColumnsShapeBase, ColumnsParsers, QueryHookUtils, 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
|
+
import { QueryResult as QueryResult$1, QueryBuilder as QueryBuilder$1, QueryInternal as QueryInternal$1, Adapter as Adapter$1, QueryData as QueryData$1, UpsertThis as UpsertThis$1, UpsertResult as UpsertResult$1 } from 'pqb';
|
|
4
5
|
import { inspect } from 'node:util';
|
|
5
6
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
-
import { QueryResult as QueryResult$1, QueryBuilder as QueryBuilder$1, QueryInternal as QueryInternal$1, Adapter as Adapter$1, QueryData as QueryData$1 } from 'pqb';
|
|
7
7
|
|
|
8
8
|
interface TypeParsers {
|
|
9
9
|
[K: number]: (input: string) => unknown;
|
|
@@ -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;
|
|
@@ -415,17 +416,17 @@ interface CommonQueryData {
|
|
|
415
416
|
hookSelect?: HookSelect;
|
|
416
417
|
computeds?: ComputedColumns;
|
|
417
418
|
selectedComputeds?: ComputedColumns;
|
|
418
|
-
before?:
|
|
419
|
+
before?: QueryBeforeHookInternal[];
|
|
419
420
|
after?: QueryAfterHook[];
|
|
420
|
-
beforeCreate?:
|
|
421
|
+
beforeCreate?: QueryBeforeHookInternal[];
|
|
421
422
|
afterCreate?: QueryAfterHook[];
|
|
422
423
|
afterCreateCommit?: QueryAfterHook[];
|
|
423
424
|
afterCreateSelect?: Set<string>;
|
|
424
|
-
beforeUpdate?:
|
|
425
|
+
beforeUpdate?: QueryBeforeHookInternal[];
|
|
425
426
|
afterUpdate?: QueryAfterHook[];
|
|
426
427
|
afterUpdateCommit?: QueryAfterHook[];
|
|
427
428
|
afterUpdateSelect?: Set<string>;
|
|
428
|
-
beforeDelete?:
|
|
429
|
+
beforeDelete?: QueryBeforeHookInternal[];
|
|
429
430
|
afterDelete?: QueryAfterHook[];
|
|
430
431
|
afterDeleteCommit?: QueryAfterHook[];
|
|
431
432
|
afterDeleteSelect?: Set<string>;
|
|
@@ -460,6 +461,8 @@ interface CommonQueryData {
|
|
|
460
461
|
targetHookSelect: HookSelect;
|
|
461
462
|
};
|
|
462
463
|
outerQuery?: Query;
|
|
464
|
+
hookCreateSet?: RecordUnknown[];
|
|
465
|
+
hookUpdateSet?: RecordUnknown[];
|
|
463
466
|
}
|
|
464
467
|
interface SelectQueryData extends CommonQueryData {
|
|
465
468
|
type: undefined | 'upsert';
|
|
@@ -482,15 +485,10 @@ interface SelectQueryData extends CommonQueryData {
|
|
|
482
485
|
mode?: 'NO WAIT' | 'SKIP LOCKED';
|
|
483
486
|
};
|
|
484
487
|
}
|
|
485
|
-
type CreateKind = 'object' | 'from';
|
|
486
488
|
interface InsertQueryData extends CommonQueryData {
|
|
487
489
|
type: 'insert';
|
|
488
|
-
kind: CreateKind;
|
|
489
490
|
columns: string[];
|
|
490
|
-
values:
|
|
491
|
-
from: Query;
|
|
492
|
-
values?: unknown[][];
|
|
493
|
-
};
|
|
491
|
+
values: InsertQueryDataObjectValues | InsertQueryDataFromValues;
|
|
494
492
|
join?: JoinItem[];
|
|
495
493
|
onConflict?: {
|
|
496
494
|
target?: OnConflictTarget;
|
|
@@ -498,6 +496,11 @@ interface InsertQueryData extends CommonQueryData {
|
|
|
498
496
|
merge?: OnConflictMerge;
|
|
499
497
|
};
|
|
500
498
|
}
|
|
499
|
+
type InsertQueryDataObjectValues = unknown[][];
|
|
500
|
+
type InsertQueryDataFromValues = {
|
|
501
|
+
from: Query;
|
|
502
|
+
values?: unknown[];
|
|
503
|
+
};
|
|
501
504
|
interface UpdateQueryDataObject {
|
|
502
505
|
[K: string]: Expression | {
|
|
503
506
|
op: string;
|
|
@@ -505,7 +508,7 @@ interface UpdateQueryDataObject {
|
|
|
505
508
|
} | unknown;
|
|
506
509
|
}
|
|
507
510
|
interface UpdatedAtDataInjector {
|
|
508
|
-
(data: UpdateQueryDataItem[]):
|
|
511
|
+
(data: UpdateQueryDataItem[]): UpdateQueryDataObject | void;
|
|
509
512
|
}
|
|
510
513
|
type UpdateQueryDataItem = UpdateQueryDataObject | UpdatedAtDataInjector;
|
|
511
514
|
interface UpdateQueryData extends CommonQueryData {
|
|
@@ -577,7 +580,8 @@ declare class NotFoundError extends OrchidOrmError {
|
|
|
577
580
|
}
|
|
578
581
|
declare class OrchidOrmInternalError extends Error {
|
|
579
582
|
#private;
|
|
580
|
-
|
|
583
|
+
data?: RecordUnknown | undefined;
|
|
584
|
+
constructor(query: Query, message?: string, data?: RecordUnknown | undefined);
|
|
581
585
|
get query(): Query;
|
|
582
586
|
}
|
|
583
587
|
type QueryErrorName = 'parseComplete' | 'bindComplete' | 'closeComplete' | 'noData' | 'portalSuspended' | 'replicationStart' | 'emptyQuery' | 'copyDone' | 'copyData' | 'rowDescription' | 'parameterDescription' | 'parameterStatus' | 'backendKeyData' | 'notification' | 'readyForQuery' | 'commandComplete' | 'dataRow' | 'copyInResponse' | 'copyOutResponse' | 'authenticationOk' | 'authenticationMD5Password' | 'authenticationCleartextPassword' | 'authenticationSASL' | 'authenticationSASLContinue' | 'authenticationSASLFinal' | 'error' | 'notice';
|
|
@@ -1435,7 +1439,7 @@ declare class Join {
|
|
|
1435
1439
|
type OnArgs<S extends SelectableBase> = [leftColumn: keyof S, rightColumn: keyof S] | [leftColumn: keyof S, op: string, rightColumn: keyof S];
|
|
1436
1440
|
declare const pushQueryOnForOuter: <T extends PickQueryMeta>(q: T, joinFrom: PickQueryMeta, joinTo: PickQueryMeta, leftColumn: string, rightColumn: string) => T;
|
|
1437
1441
|
declare const pushQueryOn: <T extends PickQueryMeta>(q: T, joinFrom: PickQueryMeta, joinTo: PickQueryMeta, ...on: OnArgs<SelectableBase>) => T;
|
|
1438
|
-
declare const pushQueryOrOn: <T extends PickQueryMeta>(q: T, joinFrom: PickQueryMeta, joinTo: PickQueryMeta, ...on: OnArgs<SelectableBase>) =>
|
|
1442
|
+
declare const pushQueryOrOn: <T extends PickQueryMeta>(q: T, joinFrom: PickQueryMeta, joinTo: PickQueryMeta, ...on: OnArgs<SelectableBase>) => never;
|
|
1439
1443
|
declare const addQueryOn: <T extends PickQueryMeta>(query: T, joinFrom: PickQueryMeta, joinTo: PickQueryMeta, ...args: OnArgs<SelectableBase>) => T;
|
|
1440
1444
|
type OnJsonPathEqualsArgs<S extends SelectableBase> = [
|
|
1441
1445
|
leftColumn: keyof S,
|
|
@@ -4468,11 +4472,11 @@ declare const _queryInsertManyFrom: <T extends CreateSelf>(q: T, query: IsQuery)
|
|
|
4468
4472
|
declare const _queryDefaults: <T extends CreateSelf, Data extends Partial<CreateData<T, CreateBelongsToData<T>>>>(q: T, data: Data) => AddQueryDefaults<T, { [K in keyof Data]: true; }>;
|
|
4469
4473
|
/**
|
|
4470
4474
|
* Names of all create methods,
|
|
4471
|
-
* is used in
|
|
4475
|
+
* is used in relational query to remove these methods if chained relation shouldn't have them,
|
|
4472
4476
|
* for the case of has one/many through.
|
|
4473
4477
|
*/
|
|
4474
4478
|
type CreateMethodsNames = 'create' | 'insert' | 'createMany' | 'insertMany' | 'createFrom' | 'insertFrom' | 'createManyFrom' | 'insertManyFrom';
|
|
4475
|
-
declare class
|
|
4479
|
+
declare class QueryCreate {
|
|
4476
4480
|
/**
|
|
4477
4481
|
* `create` and `insert` create a single record.
|
|
4478
4482
|
*
|
|
@@ -5396,7 +5400,7 @@ type AfterHook<Select extends PropertyKey[], Shape extends QueryColumns> = Query
|
|
|
5396
5400
|
}[]>;
|
|
5397
5401
|
type HookSelectArg<T extends PickQueryShape> = (keyof T['shape'] & string)[];
|
|
5398
5402
|
type HookAction = 'Create' | 'Update' | 'Delete';
|
|
5399
|
-
declare const _queryHookBeforeQuery: <T extends PickQueryShape>(q: T, cb:
|
|
5403
|
+
declare const _queryHookBeforeQuery: <T extends PickQueryShape>(q: T, cb: QueryBeforeHookInternal) => T;
|
|
5400
5404
|
declare const _queryHookAfterQuery: <T extends PickQueryShape>(q: T, cb: QueryAfterHook) => T;
|
|
5401
5405
|
declare const _queryHookBeforeCreate: <T extends PickQueryShape>(q: T, cb: QueryBeforeHook) => T;
|
|
5402
5406
|
declare const _queryHookAfterCreate: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
@@ -5407,7 +5411,7 @@ declare const _queryHookAfterUpdateCommit: <T extends PickQueryShape, S extends
|
|
|
5407
5411
|
declare const _queryHookBeforeSave: <T extends PickQueryShape>(q: T, cb: QueryBeforeHook) => T;
|
|
5408
5412
|
declare const _queryHookAfterSave: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5409
5413
|
declare const _queryAfterSaveCommit: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5410
|
-
declare const _queryHookBeforeDelete: <T extends PickQueryShape>(q: T, cb:
|
|
5414
|
+
declare const _queryHookBeforeDelete: <T extends PickQueryShape>(q: T, cb: QueryBeforeHookInternal) => T;
|
|
5411
5415
|
declare const _queryHookAfterDelete: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5412
5416
|
declare const _queryHookAfterDeleteCommit: <T extends PickQueryShape, S extends HookSelectArg<T>>(q: T, select: S, cb: AfterHook<S, T['shape']>) => T;
|
|
5413
5417
|
declare abstract class QueryHooks {
|
|
@@ -5416,7 +5420,7 @@ declare abstract class QueryHooks {
|
|
|
5416
5420
|
*
|
|
5417
5421
|
* @param cb - function to call, first argument is a query object
|
|
5418
5422
|
*/
|
|
5419
|
-
beforeQuery<T>(this: T, cb:
|
|
5423
|
+
beforeQuery<T>(this: T, cb: QueryBeforeHookInternal): T;
|
|
5420
5424
|
/**
|
|
5421
5425
|
* Run the function after any kind of query.
|
|
5422
5426
|
* Enforces wrapping the query into a transaction.
|
|
@@ -5506,7 +5510,7 @@ declare abstract class QueryHooks {
|
|
|
5506
5510
|
*
|
|
5507
5511
|
* @param cb - function to call, first argument is a query object
|
|
5508
5512
|
*/
|
|
5509
|
-
beforeDelete<T>(this: T, cb:
|
|
5513
|
+
beforeDelete<T>(this: T, cb: QueryBeforeHookInternal): T;
|
|
5510
5514
|
/**
|
|
5511
5515
|
* Run the function after a `delete` kind of query.
|
|
5512
5516
|
* Enforces wrapping the query into a transaction.
|
|
@@ -6272,10 +6276,10 @@ type UpdateColumn<T extends UpdateSelf, Key extends keyof T['inputType']> = T['i
|
|
|
6272
6276
|
type UpdateRelationData<T extends UpdateSelf, Rel extends RelationConfigBase> = T['returnType'] extends undefined | 'all' ? Rel['dataForUpdate'] : Rel['dataForUpdateOne'];
|
|
6273
6277
|
type UpdateArg<T extends UpdateSelf> = T['meta']['hasWhere'] extends true ? UpdateData<T> : never;
|
|
6274
6278
|
type UpdateResult<T extends UpdateSelf> = T['meta']['hasSelect'] extends true ? SetQueryKind<T, 'update'> : T['returnType'] extends undefined | 'all' ? SetQueryReturnsRowCountMany<T, 'update'> : SetQueryReturnsRowCount<T, 'update'>;
|
|
6275
|
-
type NumericColumns<T extends
|
|
6276
|
-
[K in keyof T['
|
|
6277
|
-
}[keyof T['
|
|
6278
|
-
type ChangeCountArg<T extends
|
|
6279
|
+
type NumericColumns<T extends UpdateSelf> = {
|
|
6280
|
+
[K in keyof T['inputType']]: Exclude<T['shape'][K]['queryType'], string> extends number | bigint | null ? K : never;
|
|
6281
|
+
}[keyof T['inputType']];
|
|
6282
|
+
type ChangeCountArg<T extends UpdateSelf> = NumericColumns<T> | {
|
|
6279
6283
|
[K in NumericColumns<T>]?: T['shape'][K]['type'] extends number | null ? number : number | string | bigint;
|
|
6280
6284
|
};
|
|
6281
6285
|
interface UpdateCtx {
|
|
@@ -6899,7 +6903,6 @@ declare class SearchMethods {
|
|
|
6899
6903
|
search<T extends PickQueryMeta, As extends string>(this: T, arg: SearchArg<T, As>): WhereSearchResult<T, As>;
|
|
6900
6904
|
}
|
|
6901
6905
|
|
|
6902
|
-
type OrCreateArg<Data> = Data | (() => Data);
|
|
6903
6906
|
type UpsertCreate<DataKey extends PropertyKey, CD> = {
|
|
6904
6907
|
[K in keyof CD as K extends DataKey ? never : K]: CD[K];
|
|
6905
6908
|
} & {
|
|
@@ -6913,7 +6916,7 @@ interface UpsertThis extends UpdateSelf, CreateSelf {
|
|
|
6913
6916
|
interface MetaPropHasWhere extends QueryMetaBase {
|
|
6914
6917
|
hasWhere: true;
|
|
6915
6918
|
}
|
|
6916
|
-
|
|
6919
|
+
interface QueryUpsert {
|
|
6917
6920
|
/**
|
|
6918
6921
|
* `upsert` tries to update a single record, and then it creates the record if it doesn't yet exist.
|
|
6919
6922
|
*
|
|
@@ -7023,73 +7026,8 @@ declare class QueryUpsertOrCreate {
|
|
|
7023
7026
|
data: Update;
|
|
7024
7027
|
create: UpsertCreate<keyof Update, CreateData<T, BT>> | ((update: Update) => UpsertCreate<keyof Update, CreateData<T, BT>>);
|
|
7025
7028
|
}): UpsertResult<T>;
|
|
7026
|
-
/**
|
|
7027
|
-
* `orCreate` creates a record only if it was not found by conditions.
|
|
7028
|
-
*
|
|
7029
|
-
* `find` or `findBy` must precede `orCreate`.
|
|
7030
|
-
*
|
|
7031
|
-
* It is accepting the same argument as `create` commands.
|
|
7032
|
-
*
|
|
7033
|
-
* No result is returned by default, place `get`, `select`, or `selectAll` before `orCreate` to specify returning columns.
|
|
7034
|
-
*
|
|
7035
|
-
* ```ts
|
|
7036
|
-
* const user = await db.user
|
|
7037
|
-
* .selectAll()
|
|
7038
|
-
* .findBy({ email: 'some@email.com' })
|
|
7039
|
-
* .orCreate({
|
|
7040
|
-
* email: 'some@email.com',
|
|
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'),
|
|
7046
|
-
* });
|
|
7047
|
-
* ```
|
|
7048
|
-
*
|
|
7049
|
-
* The data can be returned from a function, it won't be called if the record was found:
|
|
7050
|
-
*
|
|
7051
|
-
* ```ts
|
|
7052
|
-
* const user = await User.selectAll()
|
|
7053
|
-
* .findBy({ email: 'some@email.com' })
|
|
7054
|
-
* .orCreate(() => ({
|
|
7055
|
-
* email: 'some@email.com',
|
|
7056
|
-
* name: 'created user',
|
|
7057
|
-
* }));
|
|
7058
|
-
* ```
|
|
7059
|
-
*
|
|
7060
|
-
* `orCreate` works by performing just a single query in the case if the record exists, and one additional query when the record does not exist.
|
|
7061
|
-
*
|
|
7062
|
-
* At first, it performs a "find" query, the query cost is exact same as if you didn't use `orCreate`.
|
|
7063
|
-
*
|
|
7064
|
-
* Then, if the record wasn't found, it performs a single query with CTE expressions to try finding it again, for the case it was already created just a moment before,
|
|
7065
|
-
* and then it creates the record if it's still not found. Using such CTE allows to skip using transactions, while still conforming to atomicity.
|
|
7066
|
-
*
|
|
7067
|
-
* ```sql
|
|
7068
|
-
* -- first query
|
|
7069
|
-
* SELECT * FROM "table" WHERE "key" = 'value'
|
|
7070
|
-
*
|
|
7071
|
-
* -- the record could have been created in between these two queries
|
|
7072
|
-
*
|
|
7073
|
-
* -- second query
|
|
7074
|
-
* WITH find_row AS (
|
|
7075
|
-
* SELECT * FROM "table" WHERE "key" = 'value'
|
|
7076
|
-
* )
|
|
7077
|
-
* WITH insert_row AS (
|
|
7078
|
-
* INSERT INTO "table" ("key")
|
|
7079
|
-
* SELECT 'value'
|
|
7080
|
-
* -- skip the insert if the row already exists
|
|
7081
|
-
* WHERE NOT EXISTS (SELECT 1 FROM find_row)
|
|
7082
|
-
* RETURNING *
|
|
7083
|
-
* )
|
|
7084
|
-
* SELECT * FROM find_row
|
|
7085
|
-
* UNION ALL
|
|
7086
|
-
* SELECT * FROM insert_row
|
|
7087
|
-
* ```
|
|
7088
|
-
*
|
|
7089
|
-
* @param data - the same data as for `create`, it may be returned from a callback
|
|
7090
|
-
*/
|
|
7091
|
-
orCreate<T extends UpsertThis, BT extends CreateBelongsToData<T>>(this: T, data: OrCreateArg<CreateData<T, BT>>): UpsertResult<T>;
|
|
7092
7029
|
}
|
|
7030
|
+
declare const QueryUpsert: QueryUpsert;
|
|
7093
7031
|
|
|
7094
7032
|
declare class TransformMethods {
|
|
7095
7033
|
/**
|
|
@@ -7223,6 +7161,77 @@ declare class QueryMap {
|
|
|
7223
7161
|
};
|
|
7224
7162
|
}
|
|
7225
7163
|
|
|
7164
|
+
type OrCreateArg<Data> = Data | (() => Data);
|
|
7165
|
+
interface QueryOrCreate {
|
|
7166
|
+
/**
|
|
7167
|
+
* `orCreate` creates a record only if it was not found by conditions.
|
|
7168
|
+
*
|
|
7169
|
+
* `find` or `findBy` must precede `orCreate`.
|
|
7170
|
+
*
|
|
7171
|
+
* It is accepting the same argument as `create` commands.
|
|
7172
|
+
*
|
|
7173
|
+
* No result is returned by default, place `get`, `select`, or `selectAll` before `orCreate` to specify returning columns.
|
|
7174
|
+
*
|
|
7175
|
+
* ```ts
|
|
7176
|
+
* const user = await db.user
|
|
7177
|
+
* .selectAll()
|
|
7178
|
+
* .findBy({ email: 'some@email.com' })
|
|
7179
|
+
* .orCreate({
|
|
7180
|
+
* email: 'some@email.com',
|
|
7181
|
+
* name: 'created user',
|
|
7182
|
+
* // supports sql and nested queries
|
|
7183
|
+
* fromSQL: () => sql`*SQL expression*`,
|
|
7184
|
+
* fromQuery: () => db.someTable.create(data).get('column'),
|
|
7185
|
+
* fromRelated: (q) => q.relatedTable.update(data).get('column'),
|
|
7186
|
+
* });
|
|
7187
|
+
* ```
|
|
7188
|
+
*
|
|
7189
|
+
* The data can be returned from a function, it won't be called if the record was found:
|
|
7190
|
+
*
|
|
7191
|
+
* ```ts
|
|
7192
|
+
* const user = await User.selectAll()
|
|
7193
|
+
* .findBy({ email: 'some@email.com' })
|
|
7194
|
+
* .orCreate(() => ({
|
|
7195
|
+
* email: 'some@email.com',
|
|
7196
|
+
* name: 'created user',
|
|
7197
|
+
* }));
|
|
7198
|
+
* ```
|
|
7199
|
+
*
|
|
7200
|
+
* `orCreate` works by performing just a single query in the case if the record exists, and one additional query when the record does not exist.
|
|
7201
|
+
*
|
|
7202
|
+
* At first, it performs a "find" query, the query cost is exact same as if you didn't use `orCreate`.
|
|
7203
|
+
*
|
|
7204
|
+
* Then, if the record wasn't found, it performs a single query with CTE expressions to try finding it again, for the case it was already created just a moment before,
|
|
7205
|
+
* and then it creates the record if it's still not found. Using such CTE allows to skip using transactions, while still conforming to atomicity.
|
|
7206
|
+
*
|
|
7207
|
+
* ```sql
|
|
7208
|
+
* -- first query
|
|
7209
|
+
* SELECT * FROM "table" WHERE "key" = 'value'
|
|
7210
|
+
*
|
|
7211
|
+
* -- the record could have been created in between these two queries
|
|
7212
|
+
*
|
|
7213
|
+
* -- second query
|
|
7214
|
+
* WITH find_row AS (
|
|
7215
|
+
* SELECT * FROM "table" WHERE "key" = 'value'
|
|
7216
|
+
* )
|
|
7217
|
+
* WITH insert_row AS (
|
|
7218
|
+
* INSERT INTO "table" ("key")
|
|
7219
|
+
* SELECT 'value'
|
|
7220
|
+
* -- skip the insert if the row already exists
|
|
7221
|
+
* WHERE NOT EXISTS (SELECT 1 FROM find_row)
|
|
7222
|
+
* RETURNING *
|
|
7223
|
+
* )
|
|
7224
|
+
* SELECT * FROM find_row
|
|
7225
|
+
* UNION ALL
|
|
7226
|
+
* SELECT * FROM insert_row
|
|
7227
|
+
* ```
|
|
7228
|
+
*
|
|
7229
|
+
* @param data - the same data as for `create`, it may be returned from a callback
|
|
7230
|
+
*/
|
|
7231
|
+
orCreate<T extends UpsertThis$1, BT extends CreateBelongsToData<T>>(this: T, data: OrCreateArg<CreateData<T, BT>>): UpsertResult$1<T>;
|
|
7232
|
+
}
|
|
7233
|
+
declare const QueryOrCreate: QueryOrCreate;
|
|
7234
|
+
|
|
7226
7235
|
interface WindowArg<T extends OrderArgSelf> {
|
|
7227
7236
|
[K: string]: WindowArgDeclaration<T> | Expression;
|
|
7228
7237
|
}
|
|
@@ -7313,7 +7322,7 @@ interface SubQueryReturningSingle extends QueryMetaIsSubQuery {
|
|
|
7313
7322
|
returnType: 'one' | 'oneOrThrow';
|
|
7314
7323
|
}
|
|
7315
7324
|
type WrapQueryArg = FromQuerySelf;
|
|
7316
|
-
interface QueryMethods<ColumnTypes> extends AsMethods, AggregateMethods, Select, FromMethods, Join, WithMethods, Union, JsonMethods,
|
|
7325
|
+
interface QueryMethods<ColumnTypes> extends AsMethods, AggregateMethods, Select, FromMethods, Join, WithMethods, Union, JsonMethods, QueryCreate, Update, Delete, Transaction, For, Where, SearchMethods, Clear, Having, QueryLog, QueryHooks, QueryUpsert, QueryOrCreate, QueryGet, MergeQueryMethods, SqlMethod<ColumnTypes>, TransformMethods, QueryMap, ScopeMethods, SoftDeleteMethods, ExpressionMethods {
|
|
7317
7326
|
}
|
|
7318
7327
|
declare class QueryMethods<ColumnTypes> {
|
|
7319
7328
|
/**
|
|
@@ -8235,11 +8244,6 @@ type SetQueryTableAlias<T extends PickQueryMetaTableShape, As extends string> =
|
|
|
8235
8244
|
} : T['meta'][K];
|
|
8236
8245
|
} : T[K];
|
|
8237
8246
|
};
|
|
8238
|
-
interface QueryOrExpression<T> {
|
|
8239
|
-
result: {
|
|
8240
|
-
value: QueryColumn<T>;
|
|
8241
|
-
};
|
|
8242
|
-
}
|
|
8243
8247
|
interface ReturnsQueryOrExpression<T> {
|
|
8244
8248
|
(): QueryOrExpression<T>;
|
|
8245
8249
|
}
|
|
@@ -8832,14 +8836,6 @@ declare const _clone: (q: unknown) => Query;
|
|
|
8832
8836
|
* @param value - array with values
|
|
8833
8837
|
*/
|
|
8834
8838
|
declare const pushQueryArrayImmutable: <T extends PickQueryQ>(q: T, key: string, value: unknown[]) => T;
|
|
8835
|
-
/**
|
|
8836
|
-
* Push a new element into an array in the query data - immutable version
|
|
8837
|
-
*
|
|
8838
|
-
* @param q - query
|
|
8839
|
-
* @param key - key to get the array
|
|
8840
|
-
* @param value - new element to push
|
|
8841
|
-
*/
|
|
8842
|
-
declare const pushQueryValueImmutable: <T extends PickQueryQ>(q: T, key: string, value: unknown) => T;
|
|
8843
8839
|
/**
|
|
8844
8840
|
* Set value into the object in query data, create the object if it doesn't yet exist.
|
|
8845
8841
|
* Does not mutate the object.
|
|
@@ -9002,4 +8998,4 @@ type CopyResult<T extends PickQueryMeta> = SetQueryKind<T, 'copy'>;
|
|
|
9002
8998
|
*/
|
|
9003
8999
|
declare function copyTableData<T extends PickQueryMetaShape>(query: T, arg: CopyArg<T>): CopyResult<T>;
|
|
9004
9000
|
|
|
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 };
|
|
9001
|
+
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, 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, 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, QueryCreate, 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 QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryScopeData, type QueryScopes, type QuerySourceItem, type QueryTake, type QueryTakeOptional, QueryUpsert, 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, 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 };
|