pqb 0.58.3 → 0.58.4
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 +575 -669
- package/dist/index.js +18 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -21
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -247,13 +247,13 @@ declare const _addToHookSelect: (query: IsQuery, selects: string[]) => void;
|
|
|
247
247
|
declare const _addToHookSelectWithTable: (query: IsQuery, selects: string[], table: string) => void;
|
|
248
248
|
|
|
249
249
|
type DelayedRelationSelect = {
|
|
250
|
-
query:
|
|
250
|
+
query: IsQuery;
|
|
251
251
|
value?: {
|
|
252
252
|
[K: string]: IsQuery;
|
|
253
253
|
};
|
|
254
254
|
};
|
|
255
|
-
declare const newDelayedRelationSelect: (query:
|
|
256
|
-
query:
|
|
255
|
+
declare const newDelayedRelationSelect: (query: IsQuery) => {
|
|
256
|
+
query: IsQuery;
|
|
257
257
|
};
|
|
258
258
|
declare const setDelayedRelation: (d: DelayedRelationSelect, as: string, value: IsQuery) => void;
|
|
259
259
|
|
|
@@ -333,18 +333,15 @@ interface QueryDataAliases extends PickQueryDataAliases {
|
|
|
333
333
|
as?: string;
|
|
334
334
|
outerAliases?: RecordString;
|
|
335
335
|
}
|
|
336
|
-
type
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
};
|
|
344
|
-
} : T['meta'][K];
|
|
345
|
-
} : T[K];
|
|
336
|
+
type SetQueryTableAlias<T extends PickQuerySelectableShapeAs, As extends string> = {
|
|
337
|
+
[K in keyof T]: K extends '__selectable' ? Omit<T['__selectable'], `${T['__as']}.${keyof T['shape'] & string}`> & {
|
|
338
|
+
[K in keyof T['shape'] & string as `${As}.${K}`]: {
|
|
339
|
+
as: K;
|
|
340
|
+
column: T['shape'][K];
|
|
341
|
+
};
|
|
342
|
+
} : K extends '__as' ? As : T[K];
|
|
346
343
|
};
|
|
347
|
-
type AsQueryArg =
|
|
344
|
+
type AsQueryArg = PickQuerySelectableShapeAs;
|
|
348
345
|
/** getters **/
|
|
349
346
|
declare const getQueryAs: (q: {
|
|
350
347
|
table?: string;
|
|
@@ -352,21 +349,21 @@ declare const getQueryAs: (q: {
|
|
|
352
349
|
as?: string;
|
|
353
350
|
};
|
|
354
351
|
}) => string;
|
|
355
|
-
declare const _getQueryAs: (q:
|
|
352
|
+
declare const _getQueryAs: (q: Query) => string | undefined;
|
|
356
353
|
declare const _getQueryFreeAlias: (q: QueryDataAliases, as: string) => string;
|
|
357
|
-
declare const _checkIfAliased: (q:
|
|
354
|
+
declare const _checkIfAliased: (q: Query, as: string, name: string) => boolean;
|
|
358
355
|
declare const _getQueryAliasOrName: (q: PickQueryDataAliases, as: string) => string;
|
|
359
|
-
declare const _getQueryOuterAliases: (q:
|
|
356
|
+
declare const _getQueryOuterAliases: (q: QueryDataAliases) => RecordString | undefined;
|
|
360
357
|
/** setters **/
|
|
361
|
-
declare const _setQueryAs: <T extends
|
|
362
|
-
declare const _setQueryAlias: (q:
|
|
363
|
-
declare const _setSubQueryAliases: (q:
|
|
358
|
+
declare const _setQueryAs: <T extends PickQuerySelectableShapeAs, As extends string>(self: T, as: As) => SetQueryTableAlias<T, As>;
|
|
359
|
+
declare const _setQueryAlias: (q: Query, name: string, as: string) => void;
|
|
360
|
+
declare const _setSubQueryAliases: (q: Query) => void;
|
|
364
361
|
/**
|
|
365
362
|
* Is used in `chain`: combines query and its relation aliases,
|
|
366
363
|
* stores the result to the relation query data.
|
|
367
364
|
*/
|
|
368
|
-
declare const _applyRelationAliases: (query:
|
|
369
|
-
declare const _copyQueryAliasToQuery: (fromQuery:
|
|
365
|
+
declare const _applyRelationAliases: (query: Query, relQueryData: QueryData) => void;
|
|
366
|
+
declare const _copyQueryAliasToQuery: (fromQuery: Query, toQuery: Query, key: string) => string;
|
|
370
367
|
declare abstract class QueryAsMethods {
|
|
371
368
|
/**
|
|
372
369
|
* Sets table alias:
|
|
@@ -409,10 +406,8 @@ interface CteQueryBuilder<T extends PickQueryWithDataColumnTypes> extends Query
|
|
|
409
406
|
relations: EmptyObject;
|
|
410
407
|
withData: T['withData'];
|
|
411
408
|
}
|
|
412
|
-
type CteResult<T extends
|
|
413
|
-
[K in keyof T]: K extends '
|
|
414
|
-
[K in keyof T['meta']]: K extends 'kind' ? 'select' : T['meta'][K];
|
|
415
|
-
} : K extends 'withData' ? {
|
|
409
|
+
type CteResult<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult> = {
|
|
410
|
+
[K in keyof T]: K extends 'withData' ? {
|
|
416
411
|
[K in keyof T['withData'] | Name]: K extends Name ? {
|
|
417
412
|
table: Name;
|
|
418
413
|
shape: Q['result'];
|
|
@@ -535,8 +530,8 @@ declare class CteQuery {
|
|
|
535
530
|
* ]);
|
|
536
531
|
* ```
|
|
537
532
|
*/
|
|
538
|
-
with<T extends
|
|
539
|
-
with<T extends
|
|
533
|
+
with<T extends PickQueryWithDataColumnTypes, Name extends string, Q>(this: T, name: Name, query: Q | ((q: CteQueryBuilder<T>) => Q)): CteResult<T, Name, Q extends PickQueryResult ? Q : never>;
|
|
534
|
+
with<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult>(this: T, name: Name, options: CteArgsOptions, query: Q | ((q: CteQueryBuilder<T>) => Q)): CteResult<T, Name, Q>;
|
|
540
535
|
/**
|
|
541
536
|
* It is priceless for fetching tree-like structures, or any other recursive cases.
|
|
542
537
|
*
|
|
@@ -620,10 +615,10 @@ declare class CteQuery {
|
|
|
620
615
|
* .where({ n: { gt: 10 } });
|
|
621
616
|
* ```
|
|
622
617
|
*/
|
|
623
|
-
withRecursive<T extends
|
|
618
|
+
withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult, Result = CteResult<T, Name, Q>>(this: T, name: Name, base: Q | ((qb: CteQueryBuilder<T>) => Q), recursive: (qb: {
|
|
624
619
|
[K in keyof Result]: K extends 'result' ? Q['result'] : Result[K];
|
|
625
620
|
}) => PickQueryResult): Result;
|
|
626
|
-
withRecursive<T extends
|
|
621
|
+
withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult, Result = CteResult<T, Name, Q>>(this: T, name: Name, options: CteRecursiveOptions, base: Q | ((qb: CteQueryBuilder<T>) => Q), recursive: (qb: {
|
|
627
622
|
[K in keyof Result]: K extends 'result' ? Q['result'] : Result[K];
|
|
628
623
|
}) => PickQueryResult): Result;
|
|
629
624
|
/**
|
|
@@ -712,7 +707,9 @@ declare namespace ColumnsShape {
|
|
|
712
707
|
[K in keyof Shape]: Shape[K]['outputType'];
|
|
713
708
|
};
|
|
714
709
|
export type DefaultSelectOutput<Shape extends Column.QueryColumnsInit> = {
|
|
715
|
-
[K in
|
|
710
|
+
[K in {
|
|
711
|
+
[K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K;
|
|
712
|
+
}[keyof Shape]]: Shape[K]['outputType'];
|
|
716
713
|
};
|
|
717
714
|
export interface MapToObjectColumn<Shape extends Column.QueryColumns> {
|
|
718
715
|
dataType: 'object';
|
|
@@ -760,30 +757,6 @@ declare namespace ColumnsShape {
|
|
|
760
757
|
export { };
|
|
761
758
|
}
|
|
762
759
|
|
|
763
|
-
interface QuerySelectable {
|
|
764
|
-
[K: PropertyKey]: {
|
|
765
|
-
as: string;
|
|
766
|
-
column: Column.Pick.QueryColumn;
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
interface QueryMetaBase<Scopes extends RecordKeyTrue = RecordKeyTrue> {
|
|
770
|
-
kind: string;
|
|
771
|
-
as?: string;
|
|
772
|
-
subQuery: boolean;
|
|
773
|
-
hasSelect?: true;
|
|
774
|
-
hasWhere?: true;
|
|
775
|
-
defaults: EmptyObject;
|
|
776
|
-
tsQuery?: string;
|
|
777
|
-
scopes: Scopes;
|
|
778
|
-
selectable: QuerySelectable;
|
|
779
|
-
defaultSelect: PropertyKey;
|
|
780
|
-
}
|
|
781
|
-
interface QueryMetaIsSubQuery {
|
|
782
|
-
meta: {
|
|
783
|
-
subQuery: true;
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
|
|
787
760
|
interface PickQueryDataParsers {
|
|
788
761
|
defaultParsers?: ColumnsParsers;
|
|
789
762
|
parsers?: ColumnsParsers;
|
|
@@ -830,24 +803,18 @@ declare const handleResult: HandleResult;
|
|
|
830
803
|
declare const parseRecord: (parsers: ColumnsParsers, row: any) => unknown;
|
|
831
804
|
declare const filterResult: (q: Query, returnType: QueryReturnType, queryResult: QueryResult, result: unknown, tempColumns: Set<string> | undefined, hasAfterHook?: unknown) => unknown;
|
|
832
805
|
|
|
833
|
-
interface SelectSelf {
|
|
834
|
-
shape: Column.QueryColumns;
|
|
835
|
-
relations: RelationsBase;
|
|
836
|
-
result: Column.QueryColumns;
|
|
837
|
-
meta: QueryMetaBase;
|
|
838
|
-
returnType: QueryReturnType;
|
|
839
|
-
withData: EmptyObject;
|
|
806
|
+
interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape, PickQueryRelations, PickQueryResult, PickQueryReturnType, PickQueryWithData {
|
|
840
807
|
}
|
|
841
|
-
type SelectArg<T extends SelectSelf> = '*' | keyof T['
|
|
842
|
-
type SelectArgs<T extends SelectSelf> = ('*' | keyof T['
|
|
843
|
-
interface SubQueryAddition<T extends PickQueryWithData> extends
|
|
808
|
+
type SelectArg<T extends SelectSelf> = '*' | keyof T['__selectable'];
|
|
809
|
+
type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
|
|
810
|
+
interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
|
|
844
811
|
withData: T['withData'];
|
|
845
812
|
}
|
|
846
813
|
type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject extends T['relations'] ? T : {
|
|
847
814
|
[K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['maybeSingle'] & SubQueryAddition<T> : K extends keyof T ? T[K] : never;
|
|
848
815
|
};
|
|
849
816
|
interface SelectAsArg<T extends SelectSelf> {
|
|
850
|
-
[K: string]: keyof T['
|
|
817
|
+
[K: string]: keyof T['__selectable'] | Expression | ((q: SelectAsFnArg<T>) => unknown);
|
|
851
818
|
}
|
|
852
819
|
type SelectAsFnReturnType = {
|
|
853
820
|
result: Column.QueryColumns;
|
|
@@ -858,45 +825,42 @@ interface SelectAsCheckReturnTypes {
|
|
|
858
825
|
}
|
|
859
826
|
type SelectReturnType<T extends PickQueryReturnType> = T['returnType'] extends 'valueOrThrow' ? 'oneOrThrow' : T extends 'value' ? 'one' : T['returnType'] extends 'pluck' ? 'all' : T['returnType'];
|
|
860
827
|
type SelectResult<T extends SelectSelf, Columns extends PropertyKey[]> = {
|
|
861
|
-
[K in keyof T]: K extends 'result' ? {
|
|
862
|
-
[K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['
|
|
863
|
-
} & (T['
|
|
864
|
-
[K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['
|
|
865
|
-
} & (T['
|
|
866
|
-
}
|
|
828
|
+
[K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
|
|
829
|
+
[K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'];
|
|
830
|
+
} & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, {
|
|
831
|
+
[K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'];
|
|
832
|
+
} & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K];
|
|
833
|
+
};
|
|
867
834
|
type SelectResultObj<T extends SelectSelf, Obj> = Obj extends SelectAsCheckReturnTypes ? {
|
|
868
|
-
[K in keyof T]: K extends '
|
|
869
|
-
[K in T['
|
|
835
|
+
[K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? {
|
|
836
|
+
[K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never;
|
|
870
837
|
} : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, {
|
|
871
|
-
[K in T['
|
|
838
|
+
[K in T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? keyof Obj | keyof T['result'] : keyof Obj]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : K extends keyof T['result'] ? T['result'][K] : never;
|
|
872
839
|
}> : T[K];
|
|
873
840
|
} : `Invalid return type of ${{
|
|
874
841
|
[K in keyof Obj]: Obj[K] extends (...args: any[]) => any ? ReturnType<Obj[K]> extends SelectAsFnReturnType ? never : K : never;
|
|
875
842
|
}[keyof Obj] & string}`;
|
|
876
843
|
type SelectResultColumnsAndObj<T extends SelectSelf, Columns extends PropertyKey[], Obj> = {
|
|
877
|
-
[K in keyof T]: K extends '
|
|
844
|
+
[K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? // Combine previously selected items, all columns if * was provided,
|
|
878
845
|
{
|
|
879
|
-
[K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['
|
|
880
|
-
} & (T['
|
|
881
|
-
[K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['
|
|
882
|
-
} & (T['
|
|
846
|
+
[K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'];
|
|
847
|
+
} & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown) : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, {
|
|
848
|
+
[K in ('*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number]) | keyof Obj as K extends Columns[number] ? T['__selectable'][K]['as'] : K]: K extends keyof Obj ? SelectAsValueResult<T, Obj[K]> : T['__selectable'][K]['column'];
|
|
849
|
+
} & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K];
|
|
883
850
|
};
|
|
884
|
-
interface AllowedRelationOneQueryForSelectable extends
|
|
851
|
+
interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
|
|
885
852
|
result: Column.QueryColumns;
|
|
886
853
|
returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
|
|
887
854
|
}
|
|
888
|
-
type
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
}[keyof Obj]>;
|
|
898
|
-
};
|
|
899
|
-
type SelectAsValueResult<T extends SelectSelf, Arg> = Arg extends keyof T['meta']['selectable'] ? T['meta']['selectable'][Arg]['column'] : Arg extends Expression ? Arg['result']['value'] : Arg extends (q: never) => IsQuery ? SelectSubQueryResult<ReturnType<Arg>> : Arg extends (q: never) => Expression ? ReturnType<Arg>['result']['value'] : Arg extends (q: never) => IsQuery | Expression ? SelectSubQueryResult<Exclude<ReturnType<Arg>, Expression>> | Exclude<ReturnType<Arg>, IsQuery>['result']['value'] : never;
|
|
855
|
+
type SelectAsSelectable<Obj> = UnionToIntersection<{
|
|
856
|
+
[K in keyof Obj]: Obj[K] extends ((q: never) => infer R extends AllowedRelationOneQueryForSelectable) ? {
|
|
857
|
+
[C in R['returnType'] extends 'value' | 'valueOrThrow' ? K : keyof R['result'] as R['returnType'] extends 'value' | 'valueOrThrow' ? K : `${K & string}.${C & string}`]: {
|
|
858
|
+
as: C;
|
|
859
|
+
column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
|
|
860
|
+
};
|
|
861
|
+
} : never;
|
|
862
|
+
}[keyof Obj]>;
|
|
863
|
+
type SelectAsValueResult<T extends SelectSelf, Arg> = Arg extends keyof T['__selectable'] ? T['__selectable'][Arg]['column'] : Arg extends Expression ? Arg['result']['value'] : Arg extends (q: never) => IsQuery ? SelectSubQueryResult<ReturnType<Arg>> : Arg extends (q: never) => Expression ? ReturnType<Arg>['result']['value'] : Arg extends (q: never) => IsQuery | Expression ? SelectSubQueryResult<Exclude<ReturnType<Arg>, Expression>> | Exclude<ReturnType<Arg>, IsQuery>['result']['value'] : never;
|
|
900
864
|
type SelectSubQueryResult<Arg extends SelectSelf> = Arg['returnType'] extends undefined | 'all' ? ColumnsShape.MapToObjectArrayColumn<Arg['result']> : Arg['returnType'] extends 'value' | 'valueOrThrow' ? Arg['result']['value'] : Arg['returnType'] extends 'pluck' ? ColumnsShape.MapToPluckColumn<Arg['result']> : Arg['returnType'] extends 'one' ? ColumnsShape.MapToNullableObjectColumn<Arg['result']> : ColumnsShape.MapToObjectColumn<Arg['result']>;
|
|
901
865
|
declare function _querySelect<T extends SelectSelf, Columns extends SelectArgs<T>>(q: T, columns: Columns): SelectResult<T, Columns>;
|
|
902
866
|
declare function _querySelect<T extends SelectSelf, Obj extends SelectAsArg<T>>(q: T, obj: Obj): SelectResultObj<T, Obj>;
|
|
@@ -1041,7 +1005,7 @@ interface QueryBatchResult {
|
|
|
1041
1005
|
parent: any;
|
|
1042
1006
|
key: PropertyKey;
|
|
1043
1007
|
}
|
|
1044
|
-
declare const addParserForSelectItem: <T extends
|
|
1008
|
+
declare const addParserForSelectItem: <T extends PickQuerySelectable>(query: T, as: string | getValueKey | undefined, key: string, arg: SelectableOrExpression<T> | Query, columnAlias?: string, joinQuery?: boolean) => string | Expression | Query | undefined;
|
|
1045
1009
|
declare const processSelectArg: <T extends SelectSelf>(q: T, as: string | undefined, arg: SelectArg<T>, columnAs?: string | getValueKey) => SelectItem | undefined | false;
|
|
1046
1010
|
declare const setParserForSelectedString: (query: PickQueryQAndInternal, arg: string, as: string | getValueKey | undefined, columnAs?: string | getValueKey, columnAlias?: string) => string | undefined;
|
|
1047
1011
|
declare const getShapeFromSelect: (q: IsQuery, isSubQuery?: boolean) => Column.QueryColumns;
|
|
@@ -1219,14 +1183,17 @@ type WithSelectable<W extends WithDataItem> = keyof W['shape'] | `${W['table']}.
|
|
|
1219
1183
|
* The first argument of all `join` and `joinLateral` methods.
|
|
1220
1184
|
* See argument of {@link join}.
|
|
1221
1185
|
*/
|
|
1222
|
-
type JoinFirstArg<T extends PickQueryRelationsWithData> =
|
|
1186
|
+
type JoinFirstArg<T extends PickQueryRelationsWithData> = PickQueryResultAs | keyof T['relations'] | keyof T['withData'] | ((q: {
|
|
1223
1187
|
[K in keyof T['relations']]: T['relations'][K]['query'];
|
|
1224
|
-
}) =>
|
|
1188
|
+
}) => PickQueryResultAs) | FnPickQueryResultAs;
|
|
1189
|
+
interface FnPickQueryResultAs {
|
|
1190
|
+
(): PickQueryResultAs;
|
|
1191
|
+
}
|
|
1225
1192
|
/**
|
|
1226
1193
|
* Arguments of `join` methods (not `joinLateral`).
|
|
1227
1194
|
* See {@link join}
|
|
1228
1195
|
*/
|
|
1229
|
-
type JoinArgs<T extends
|
|
1196
|
+
type JoinArgs<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>> = [on?: JoinCallback<T, Arg>] | (Arg extends PickQueryResultAs ? JoinQueryArgs<T, Arg> : Arg extends keyof T['withData'] ? JoinWithArgs<T, T['withData'][Arg]> : EmptyTuple);
|
|
1230
1197
|
/**
|
|
1231
1198
|
* Column names of the joined table that can be used to join.
|
|
1232
1199
|
* Derived from 'result', not from 'shape',
|
|
@@ -1236,53 +1203,47 @@ type JoinArgs<T extends PickQueryMetaShapeRelationsWithData, Arg extends JoinFir
|
|
|
1236
1203
|
* ```
|
|
1237
1204
|
* And the selection becomes available to use in the `ON` and to select from the joined table.
|
|
1238
1205
|
*/
|
|
1239
|
-
type JoinSelectable<Q extends
|
|
1240
|
-
type JoinQueryArgs<T extends
|
|
1206
|
+
type JoinSelectable<Q extends PickQueryResultAs> = keyof Q['result'] | `${Q['__as']}.${keyof Q['result'] & string}`;
|
|
1207
|
+
type JoinQueryArgs<T extends PickQuerySelectable, Q extends PickQueryResultAs> = [
|
|
1241
1208
|
conditions: {
|
|
1242
|
-
[K in JoinSelectable<Q>]: keyof T['
|
|
1209
|
+
[K in JoinSelectable<Q>]: keyof T['__selectable'] | Expression;
|
|
1243
1210
|
} | Expression | true
|
|
1244
1211
|
] | [
|
|
1245
1212
|
leftColumn: JoinSelectable<Q> | Expression,
|
|
1246
|
-
rightColumn: keyof T['
|
|
1213
|
+
rightColumn: keyof T['__selectable'] | Expression
|
|
1247
1214
|
] | [
|
|
1248
1215
|
leftColumn: JoinSelectable<Q> | Expression,
|
|
1249
1216
|
op: string,
|
|
1250
|
-
rightColumn: keyof T['
|
|
1217
|
+
rightColumn: keyof T['__selectable'] | Expression
|
|
1251
1218
|
];
|
|
1252
|
-
type JoinWithArgs<T extends
|
|
1219
|
+
type JoinWithArgs<T extends PickQuerySelectable, W extends WithDataItem> = [
|
|
1253
1220
|
conditions: {
|
|
1254
|
-
[K in WithSelectable<W>]: keyof T['
|
|
1221
|
+
[K in WithSelectable<W>]: keyof T['__selectable'] | Expression;
|
|
1255
1222
|
} | Expression
|
|
1256
1223
|
] | [
|
|
1257
1224
|
leftColumn: WithSelectable<W> | Expression,
|
|
1258
|
-
rightColumn: keyof T['
|
|
1225
|
+
rightColumn: keyof T['__selectable'] | Expression
|
|
1259
1226
|
] | [
|
|
1260
1227
|
leftColumn: WithSelectable<W> | Expression,
|
|
1261
1228
|
op: string,
|
|
1262
|
-
rightColumn: keyof T['
|
|
1229
|
+
rightColumn: keyof T['__selectable'] | Expression
|
|
1263
1230
|
];
|
|
1264
|
-
type JoinResultRequireMain<T extends
|
|
1265
|
-
[K in keyof T]: K extends '
|
|
1266
|
-
[K in keyof T['meta']]: K extends 'selectable' ? T['meta']['selectable'] & JoinedSelectable : T['meta'][K];
|
|
1267
|
-
} : T[K];
|
|
1231
|
+
type JoinResultRequireMain<T extends PickQuerySelectable, JoinedSelectable> = {
|
|
1232
|
+
[K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K];
|
|
1268
1233
|
};
|
|
1269
1234
|
/**
|
|
1270
1235
|
* Result of all `join` methods, not `joinLateral`.
|
|
1271
|
-
* Adds joined table columns from its 'result' to the '
|
|
1236
|
+
* Adds joined table columns from its 'result' to the '__selectable' of the query.
|
|
1272
1237
|
*/
|
|
1273
|
-
type JoinResult<T extends
|
|
1274
|
-
[K in keyof T]: K extends '
|
|
1275
|
-
[K in keyof T['meta']]: K extends 'selectable' ? T['meta']['selectable'] & JoinedSelectable : T['meta'][K];
|
|
1276
|
-
} : T[K];
|
|
1238
|
+
type JoinResult<T extends PickQuerySelectableResultReturnType, JoinedSelectable, RequireMain> = RequireMain extends true ? {
|
|
1239
|
+
[K in keyof T]: K extends '__selectable' ? T['__selectable'] & JoinedSelectable : T[K];
|
|
1277
1240
|
} : {
|
|
1278
|
-
[K in keyof T]: K extends '
|
|
1279
|
-
[K in keyof T['
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
} & JoinedSelectable : T['meta'][K];
|
|
1285
|
-
} : K extends 'result' ? {
|
|
1241
|
+
[K in keyof T]: K extends '__selectable' ? {
|
|
1242
|
+
[K in keyof T['__selectable']]: {
|
|
1243
|
+
as: T['__selectable'][K]['as'];
|
|
1244
|
+
column: Column.Modifiers.QueryColumnToNullable<T['__selectable'][K]['column']>;
|
|
1245
|
+
};
|
|
1246
|
+
} & JoinedSelectable : K extends 'result' ? {
|
|
1286
1247
|
[K in keyof T['result']]: Column.Modifiers.QueryColumnToNullable<T['result'][K]>;
|
|
1287
1248
|
} : K extends 'then' ? QueryThenByQuery<T, {
|
|
1288
1249
|
[K in keyof T['result']]: Column.Modifiers.QueryColumnToNullable<T['result'][K]>;
|
|
@@ -1292,30 +1253,22 @@ type JoinResult<T extends PickQueryMetaResultReturnType, JoinedSelectable, Requi
|
|
|
1292
1253
|
* Calls {@link JoinResult} with either callback result, if join has a callback,
|
|
1293
1254
|
* or with a query derived from the first join argument.
|
|
1294
1255
|
*/
|
|
1295
|
-
type JoinResultFromArgs<T extends
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
}
|
|
1302
|
-
table: Q['table'];
|
|
1303
|
-
meta: Q['meta'];
|
|
1304
|
-
}>, RequireJoined> : Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? JoinResultSelectable<T['withData'][Arg]['shape'], AliasOrTable<{
|
|
1305
|
-
table: T['withData'][Arg]['table'];
|
|
1306
|
-
meta: QueryMetaBase;
|
|
1307
|
-
}>, RequireJoined> : never : never, RequireMain>;
|
|
1308
|
-
type GenericJoinCallback = (...args: any[]) => PickQueryTableMetaResult;
|
|
1309
|
-
type GenericJoinCallbackTuple = [GenericJoinCallback];
|
|
1256
|
+
type JoinResultFromArgs<T extends PickQuerySelectableResultRelationsWithDataReturnType, Arg, Args extends unknown[], RequireJoined, RequireMain> = JoinResult<T, Args[0] extends GenericJoinCallback ? JoinResultSelectable<ReturnType<Args[0]>['result'], ReturnType<Args[0]>['__as'], RequireJoined> : Arg extends PickQueryHasSelectResultShapeAs ? JoinResultSelectable<Arg['__hasSelect'] extends true ? Arg['result'] : Arg['shape'], Arg['__as'], RequireJoined> : Arg extends keyof T['relations'] ? JoinResultSelectable<T['relations'][Arg]['query']['shape'], T['relations'][Arg]['query']['__as'], RequireJoined> : Arg extends FirstArgCallback ? JoinResultSelectable<ReturnType<Arg>['shape'], ReturnType<Arg>['__as'], RequireJoined> : Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? JoinResultSelectable<T['withData'][Arg]['shape'], T['withData'][Arg]['table'], RequireJoined> : never : never, RequireMain>;
|
|
1257
|
+
interface GenericJoinCallback {
|
|
1258
|
+
(...args: any[]): PickQueryResultAs;
|
|
1259
|
+
}
|
|
1260
|
+
interface FirstArgCallback {
|
|
1261
|
+
(...args: any[]): PickQueryShapeAs;
|
|
1262
|
+
}
|
|
1310
1263
|
/**
|
|
1311
1264
|
* Result of all `joinLateral` methods.
|
|
1312
|
-
* Adds joined table columns from its 'result' to the '
|
|
1265
|
+
* Adds joined table columns from its 'result' to the '__selectable' of the query.
|
|
1313
1266
|
*
|
|
1314
1267
|
* @param T - query type to join to
|
|
1315
1268
|
* @param Arg - first arg of join, see {@link JoinFirstArg}
|
|
1316
1269
|
* @param RequireJoined - when false, joined table shape will be mapped to make all columns optional
|
|
1317
1270
|
*/
|
|
1318
|
-
type JoinLateralResult<T extends
|
|
1271
|
+
type JoinLateralResult<T extends PickQuerySelectable, As extends string, Result extends Column.QueryColumns, RequireJoined> = JoinAddSelectable<T, JoinResultSelectable<Result, As, RequireJoined>>;
|
|
1319
1272
|
/**
|
|
1320
1273
|
* Build `selectable` type for joined table.
|
|
1321
1274
|
*
|
|
@@ -1327,26 +1280,25 @@ type JoinLateralResult<T extends PickQueryMeta, Table extends string, Meta exten
|
|
|
1327
1280
|
* The resulting selectable receives all joined table columns prefixed with the table name or alias,
|
|
1328
1281
|
* and a star prefixed with the table name or alias to select all joined columns.
|
|
1329
1282
|
*/
|
|
1330
|
-
type JoinResultSelectable<Result extends Column.QueryColumns, As extends string, RequireJoined> =
|
|
1331
|
-
[K in keyof Result & string as `${As}.${K}`]: {
|
|
1283
|
+
type JoinResultSelectable<Result extends Column.QueryColumns, As extends string, RequireJoined> = RequireJoined extends true ? {
|
|
1284
|
+
[K in '*' | (keyof Result & string) as `${As}.${K}`]: K extends '*' ? {
|
|
1285
|
+
as: As;
|
|
1286
|
+
column: ColumnsShape.MapToObjectColumn<Result>;
|
|
1287
|
+
} : {
|
|
1332
1288
|
as: K;
|
|
1333
1289
|
column: Result[K];
|
|
1334
1290
|
};
|
|
1335
1291
|
} : {
|
|
1336
|
-
[K in keyof Result & string as `${As}.${K}`]: {
|
|
1292
|
+
[K in '*' | (keyof Result & string) as `${As}.${K}`]: K extends '*' ? {
|
|
1293
|
+
as: As;
|
|
1294
|
+
column: ColumnsShape.MapToNullableObjectColumn<Result>;
|
|
1295
|
+
} : {
|
|
1337
1296
|
as: K;
|
|
1338
1297
|
column: Column.Modifiers.QueryColumnToNullable<Result[K]>;
|
|
1339
1298
|
};
|
|
1340
|
-
}) & {
|
|
1341
|
-
[K in As as `${As}.*`]: {
|
|
1342
|
-
as: K;
|
|
1343
|
-
column: RequireJoined extends true ? ColumnsShape.MapToObjectColumn<Result> : ColumnsShape.MapToNullableObjectColumn<Result>;
|
|
1344
|
-
};
|
|
1345
1299
|
};
|
|
1346
|
-
type JoinAddSelectable<T extends
|
|
1347
|
-
[K in keyof T]: K extends '
|
|
1348
|
-
[K in keyof T['meta']]: K extends 'selectable' ? T['meta']['selectable'] & Selectable : T['meta'][K];
|
|
1349
|
-
} : T[K];
|
|
1300
|
+
type JoinAddSelectable<T extends PickQuerySelectable, Selectable> = {
|
|
1301
|
+
[K in keyof T]: K extends '__selectable' ? T['__selectable'] & Selectable : T[K];
|
|
1350
1302
|
};
|
|
1351
1303
|
/**
|
|
1352
1304
|
* Map the first argument of `join` or `joinLateral` to a query type.
|
|
@@ -1356,16 +1308,16 @@ type JoinAddSelectable<T extends PickQueryMeta, Selectable> = {
|
|
|
1356
1308
|
* relation name is replaced with a relation table.
|
|
1357
1309
|
*/
|
|
1358
1310
|
type JoinArgToQuery<T extends PickQueryRelationsWithData, Arg extends JoinFirstArg<T>> = Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? {
|
|
1359
|
-
[K in '
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
column: T['withData'][Arg]['shape'][K];
|
|
1364
|
-
};
|
|
1311
|
+
[K in 'result' | '__as' | keyof T]: K extends '__as' ? T['withData'][Arg]['table'] : K extends '__selectable' ? {
|
|
1312
|
+
[K in keyof T['withData'][Arg]['shape'] & string as `${T['withData'][Arg]['table']}.${K}`]: {
|
|
1313
|
+
as: K;
|
|
1314
|
+
column: T['withData'][Arg]['shape'][K];
|
|
1365
1315
|
};
|
|
1366
1316
|
} : K extends 'result' ? T['withData'][Arg]['shape'] : K extends keyof T ? T[K] : never;
|
|
1367
|
-
} : never : Arg extends
|
|
1368
|
-
|
|
1317
|
+
} : never : Arg extends PickQuerySelectableResultAs ? Arg : Arg extends keyof T['relations'] ? T['relations'][Arg]['query'] : Arg extends JoinArgToQueryCallback ? ReturnType<Arg> : never;
|
|
1318
|
+
interface JoinArgToQueryCallback {
|
|
1319
|
+
(...args: any[]): IsQuery;
|
|
1320
|
+
}
|
|
1369
1321
|
/**
|
|
1370
1322
|
* Type of the `join` callback (not `joinLateral`).
|
|
1371
1323
|
*
|
|
@@ -1375,11 +1327,15 @@ type JoinArgToQueryCallback = (...args: any[]) => PickQueryTableMetaResult;
|
|
|
1375
1327
|
*
|
|
1376
1328
|
* Callback must return a query builder.
|
|
1377
1329
|
*/
|
|
1378
|
-
|
|
1330
|
+
interface JoinCallback<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>> {
|
|
1331
|
+
(q: JoinQueryBuilder<T, JoinArgToQuery<T, Arg>>): IsQuery;
|
|
1332
|
+
}
|
|
1379
1333
|
/**
|
|
1380
1334
|
* Type of {@link QueryJoin.join} query method.
|
|
1381
1335
|
*/
|
|
1382
|
-
|
|
1336
|
+
interface JoinQueryMethod {
|
|
1337
|
+
<T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResultFromArgs<T, Arg, Args, true, true>;
|
|
1338
|
+
}
|
|
1383
1339
|
/**
|
|
1384
1340
|
* After getting a query from a sub-query callback,
|
|
1385
1341
|
* join it to the main query in case it's a relation query.
|
|
@@ -1390,7 +1346,7 @@ type JoinQueryMethod = <T extends PickQueryMetaResultRelationsWithDataReturnType
|
|
|
1390
1346
|
* @param sub - sub-query query object
|
|
1391
1347
|
*/
|
|
1392
1348
|
declare const joinSubQuery: (q: ToSQLQuery, sub: ToSQLQuery) => SubQueryForSql;
|
|
1393
|
-
declare const _joinReturningArgs: <T extends
|
|
1349
|
+
declare const _joinReturningArgs: <T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, RequireJoined extends boolean>(query: T, require: RequireJoined, first: JoinFirstArg<never> | {
|
|
1394
1350
|
_internalJoin: Query;
|
|
1395
1351
|
}, args: JoinArgs<Query, JoinFirstArg<Query>>, forbidLateral?: boolean) => JoinItemArgs | undefined;
|
|
1396
1352
|
/**
|
|
@@ -1405,12 +1361,11 @@ declare const _joinReturningArgs: <T extends PickQueryMetaResultRelationsWithDat
|
|
|
1405
1361
|
* @param first - the first argument of join: join target
|
|
1406
1362
|
* @param args - rest join arguments: columns to join with, or a callback
|
|
1407
1363
|
*/
|
|
1408
|
-
declare const _join: <T extends
|
|
1364
|
+
declare const _join: <T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, R extends PickQueryResult, RequireJoined extends boolean, RequireMain extends boolean>(query: T, require: RequireJoined, type: string, first: JoinFirstArg<never> | {
|
|
1409
1365
|
_internalJoin: Query;
|
|
1410
1366
|
}, args: JoinArgs<Query, JoinFirstArg<Query>>) => JoinResult<T, R, RequireMain>;
|
|
1411
|
-
declare const _joinLateralProcessArg: (q: Query, arg: JoinFirstArg<any>, cb: (q: JoinQueryBuilder<
|
|
1367
|
+
declare const _joinLateralProcessArg: (q: Query, arg: JoinFirstArg<any>, cb: (q: JoinQueryBuilder<PickQuerySelectableShape, PickQuerySelectableResultAs>) => {
|
|
1412
1368
|
table: string;
|
|
1413
|
-
meta: QueryMetaBase;
|
|
1414
1369
|
result: Column.QueryColumns;
|
|
1415
1370
|
}) => Query;
|
|
1416
1371
|
/**
|
|
@@ -1425,7 +1380,7 @@ declare const _joinLateralProcessArg: (q: Query, arg: JoinFirstArg<any>, cb: (q:
|
|
|
1425
1380
|
* @param as - alias of the joined table, it is set the join lateral happens when selecting a relation in `select`
|
|
1426
1381
|
* @param innerJoinLateral - add `ON p.r IS NOT NULL` check to have INNER JOIN like experience when sub-selecting arrays.
|
|
1427
1382
|
*/
|
|
1428
|
-
declare const _joinLateral: (self:
|
|
1383
|
+
declare const _joinLateral: (self: PickQueryResultRelationsWithDataReturnTypeShape, type: string, joinQuery: Query, as?: string, innerJoinLateral?: boolean) => string | undefined;
|
|
1429
1384
|
declare class QueryJoin {
|
|
1430
1385
|
/**
|
|
1431
1386
|
* ## Select relation
|
|
@@ -1841,7 +1796,7 @@ declare class QueryJoin {
|
|
|
1841
1796
|
* @param arg - {@link JoinFirstArg}
|
|
1842
1797
|
* @param args - {@link JoinArgs}
|
|
1843
1798
|
*/
|
|
1844
|
-
join<T extends
|
|
1799
|
+
join<T extends PickQuerySelectableShapeRelationsWithDataAsResultReturnType, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResultFromArgs<T, Arg, Args, true, true>;
|
|
1845
1800
|
/**
|
|
1846
1801
|
* `leftJoin` is a method for SQL `LEFT JOIN`, which is equivalent to `OUTER JOIN`, `LEFT OUTER JOIN`.
|
|
1847
1802
|
*
|
|
@@ -1866,7 +1821,7 @@ declare class QueryJoin {
|
|
|
1866
1821
|
* @param arg - {@link JoinFirstArg}
|
|
1867
1822
|
* @param args - {@link JoinArgs}
|
|
1868
1823
|
*/
|
|
1869
|
-
leftJoin<T extends
|
|
1824
|
+
leftJoin<T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResultFromArgs<T, Arg, Args, false, true>;
|
|
1870
1825
|
/**
|
|
1871
1826
|
* `rightJoin` is a method for SQL `RIGHT JOIN`, which is equivalent to `RIGHT OUTER JOIN`.
|
|
1872
1827
|
*
|
|
@@ -1888,7 +1843,7 @@ declare class QueryJoin {
|
|
|
1888
1843
|
* @param arg - {@link JoinFirstArg}
|
|
1889
1844
|
* @param args - {@link JoinArgs}
|
|
1890
1845
|
*/
|
|
1891
|
-
rightJoin<T extends
|
|
1846
|
+
rightJoin<T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResultFromArgs<T, Arg, Args, true, false>;
|
|
1892
1847
|
/**
|
|
1893
1848
|
* `fullJoin` is a method for SQL `FULL JOIN`, which is equivalent to `FULL OUTER JOIN`.
|
|
1894
1849
|
*
|
|
@@ -1910,7 +1865,7 @@ declare class QueryJoin {
|
|
|
1910
1865
|
* @param arg - {@link JoinFirstArg}
|
|
1911
1866
|
* @param args - {@link JoinArgs}
|
|
1912
1867
|
*/
|
|
1913
|
-
fullJoin<T extends
|
|
1868
|
+
fullJoin<T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResultFromArgs<T, Arg, Args, false, false>;
|
|
1914
1869
|
/**
|
|
1915
1870
|
* `joinLateral` allows joining a table with a sub-query that can reference the main table of current query and the other joined tables.
|
|
1916
1871
|
*
|
|
@@ -1975,11 +1930,10 @@ declare class QueryJoin {
|
|
|
1975
1930
|
* @param arg - {@link JoinFirstArg}
|
|
1976
1931
|
* @param cb - {@link JoinLateralCallback}
|
|
1977
1932
|
*/
|
|
1978
|
-
joinLateral<T extends
|
|
1979
|
-
|
|
1980
|
-
meta: Meta;
|
|
1933
|
+
joinLateral<T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, Arg extends JoinFirstArg<T>, As extends string, Result extends Column.QueryColumns>(this: T, arg: Arg, cb: (q: JoinQueryBuilder<T, JoinArgToQuery<T, Arg>>) => {
|
|
1934
|
+
__as: As;
|
|
1981
1935
|
result: Result;
|
|
1982
|
-
}): JoinLateralResult<T,
|
|
1936
|
+
}): JoinLateralResult<T, As, Result, true>;
|
|
1983
1937
|
/**
|
|
1984
1938
|
* The same as {@link joinLateral}, but when no records found for the join it will result in `null`:
|
|
1985
1939
|
*
|
|
@@ -1995,11 +1949,10 @@ declare class QueryJoin {
|
|
|
1995
1949
|
* @param arg - {@link JoinFirstArg}
|
|
1996
1950
|
* @param cb - {@link JoinLateralCallback}
|
|
1997
1951
|
*/
|
|
1998
|
-
leftJoinLateral<T extends
|
|
1999
|
-
|
|
2000
|
-
meta: Meta;
|
|
1952
|
+
leftJoinLateral<T extends PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, Arg extends JoinFirstArg<T>, As extends string, Result extends Column.QueryColumns>(this: T, arg: Arg, cb: (q: JoinQueryBuilder<T, JoinArgToQuery<T, Arg>>) => {
|
|
1953
|
+
__as: As;
|
|
2001
1954
|
result: Result;
|
|
2002
|
-
}): JoinLateralResult<T,
|
|
1955
|
+
}): JoinLateralResult<T, As, Result, false>;
|
|
2003
1956
|
/**
|
|
2004
1957
|
* This method may be useful
|
|
2005
1958
|
* for combining with [createForEachFrom](/guide/create-update-delete.html#createForEachFrom-insertForEachFrom).
|
|
@@ -2034,22 +1987,20 @@ declare class QueryJoin {
|
|
|
2034
1987
|
* @param fn - declare column types
|
|
2035
1988
|
* @param data - array of data to join
|
|
2036
1989
|
*/
|
|
2037
|
-
joinData<T extends
|
|
2038
|
-
[K in keyof T]: K extends '
|
|
2039
|
-
[K in keyof
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
};
|
|
2044
|
-
} : T['meta'][K];
|
|
1990
|
+
joinData<T extends PickQuerySelectableColumnTypes, As extends string, RecordType extends Column.QueryColumnsInit, Item extends ColumnsShape.Input<RecordType>>(this: T, as: As, fn: (types: T['columnTypes']) => RecordType, data: Item[]): {
|
|
1991
|
+
[K in keyof T]: K extends '__selectable' ? T['__selectable'] & {
|
|
1992
|
+
[K in keyof RecordType & string as `${As}.${K}`]: {
|
|
1993
|
+
as: K;
|
|
1994
|
+
column: RecordType[K];
|
|
1995
|
+
};
|
|
2045
1996
|
} : T[K];
|
|
2046
1997
|
};
|
|
2047
1998
|
}
|
|
2048
1999
|
type OnArgs<S extends QuerySelectable> = [leftColumn: keyof S, rightColumn: keyof S] | [leftColumn: keyof S, op: string, rightColumn: keyof S];
|
|
2049
|
-
declare const pushQueryOnForOuter: <T extends
|
|
2050
|
-
declare const pushQueryOn: <T extends
|
|
2051
|
-
declare const pushQueryOrOn: <T extends
|
|
2052
|
-
declare const addQueryOn: <T extends
|
|
2000
|
+
declare const pushQueryOnForOuter: <T extends PickQuerySelectable>(q: T, joinFrom: PickQuerySelectable, joinTo: PickQuerySelectable, leftColumn: string, rightColumn: string) => T;
|
|
2001
|
+
declare const pushQueryOn: <T extends PickQuerySelectable>(q: T, joinFrom: PickQuerySelectable, joinTo: PickQuerySelectable, ...on: OnArgs<QuerySelectable>) => T;
|
|
2002
|
+
declare const pushQueryOrOn: <T extends PickQuerySelectable>(q: T, joinFrom: PickQuerySelectable, joinTo: PickQuerySelectable, ...on: OnArgs<QuerySelectable>) => never;
|
|
2003
|
+
declare const addQueryOn: <T extends PickQuerySelectable>(query: T, joinFrom: PickQuerySelectable, joinTo: PickQuerySelectable, ...args: OnArgs<QuerySelectable>) => T;
|
|
2053
2004
|
type OnJsonPathEqualsArgs<S extends QuerySelectable> = [
|
|
2054
2005
|
leftColumn: keyof S,
|
|
2055
2006
|
leftPath: string,
|
|
@@ -2059,25 +2010,23 @@ type OnJsonPathEqualsArgs<S extends QuerySelectable> = [
|
|
|
2059
2010
|
/**
|
|
2060
2011
|
* Mutative {@link OnMethods.prototype.on}
|
|
2061
2012
|
*/
|
|
2062
|
-
declare const _queryJoinOn: <T extends
|
|
2013
|
+
declare const _queryJoinOn: <T extends PickQuerySelectable>(q: T, args: OnArgs<T['__selectable']>) => T;
|
|
2063
2014
|
/**
|
|
2064
2015
|
* Mutative {@link OnMethods.prototype.orOn}
|
|
2065
2016
|
*/
|
|
2066
|
-
declare const _queryJoinOrOn: <T extends
|
|
2017
|
+
declare const _queryJoinOrOn: <T extends PickQuerySelectable>(q: T, args: OnArgs<T['__selectable']>) => T;
|
|
2067
2018
|
/**
|
|
2068
2019
|
* Mutative {@link OnMethods.prototype.onJsonPathEquals}
|
|
2069
2020
|
*/
|
|
2070
|
-
declare const _queryJoinOnJsonPathEquals: <T extends
|
|
2021
|
+
declare const _queryJoinOnJsonPathEquals: <T extends PickQuerySelectable>(q: T, args: OnJsonPathEqualsArgs<T["__selectable"]>) => T;
|
|
2071
2022
|
/**
|
|
2072
2023
|
* Argument of join callback.
|
|
2073
2024
|
* It is a query object of table that you're joining, with ability to select main table's columns.
|
|
2074
2025
|
* Adds {@link OnMethods.prototype.on} method and similar to the query.
|
|
2075
2026
|
*/
|
|
2076
|
-
type JoinQueryBuilder<T extends
|
|
2077
|
-
[K in keyof J]: K extends '
|
|
2078
|
-
|
|
2079
|
-
} : J[K];
|
|
2080
|
-
} & OnMethods;
|
|
2027
|
+
type JoinQueryBuilder<T extends PickQuerySelectableShape, J extends PickQuerySelectableResultAs> = {
|
|
2028
|
+
[K in keyof J | keyof OnMethods]: K extends '__selectable' ? SelectableFromShape<J['result'], J['__as']> & Omit<T['__selectable'], keyof T['shape']> : K extends keyof OnMethods ? OnMethods[K] : K extends keyof J ? J[K] : never;
|
|
2029
|
+
};
|
|
2081
2030
|
declare class OnMethods {
|
|
2082
2031
|
/**
|
|
2083
2032
|
* Use `on` to specify columns to join records.
|
|
@@ -2095,13 +2044,13 @@ declare class OnMethods {
|
|
|
2095
2044
|
*
|
|
2096
2045
|
* @param args - columns to join with
|
|
2097
2046
|
*/
|
|
2098
|
-
on<T extends
|
|
2047
|
+
on<T extends PickQuerySelectable>(this: T, ...args: OnArgs<T['__selectable']>): T;
|
|
2099
2048
|
/**
|
|
2100
2049
|
* Works as {@link on}, but the added conditions will be separated from previous with `OR`.
|
|
2101
2050
|
*
|
|
2102
2051
|
* @param args - columns to join with
|
|
2103
2052
|
*/
|
|
2104
|
-
orOn<T extends
|
|
2053
|
+
orOn<T extends PickQuerySelectable>(this: T, ...args: OnArgs<T['__selectable']>): T;
|
|
2105
2054
|
/**
|
|
2106
2055
|
* Use `onJsonPathEquals` to join record based on a field of their JSON column:
|
|
2107
2056
|
*
|
|
@@ -2114,7 +2063,7 @@ declare class OnMethods {
|
|
|
2114
2063
|
*
|
|
2115
2064
|
* @param args - columns and JSON paths to join with.
|
|
2116
2065
|
*/
|
|
2117
|
-
onJsonPathEquals<T extends
|
|
2066
|
+
onJsonPathEquals<T extends PickQuerySelectable>(this: T, ...args: OnJsonPathEqualsArgs<T['__selectable']>): T;
|
|
2118
2067
|
}
|
|
2119
2068
|
|
|
2120
2069
|
declare class ValExpression extends Expression {
|
|
@@ -2127,7 +2076,7 @@ declare class ValExpression extends Expression {
|
|
|
2127
2076
|
makeSQL(ctx: ToSqlValues): string;
|
|
2128
2077
|
}
|
|
2129
2078
|
|
|
2130
|
-
interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends
|
|
2079
|
+
interface QueryReturnsFnAdd<T extends PickQueryColumTypes> extends PickQueryHasSelect {
|
|
2131
2080
|
type<C extends Column.Pick.QueryColumn>(fn: (types: T['columnTypes']) => C): {
|
|
2132
2081
|
[K in keyof T]: K extends 'result' ? {
|
|
2133
2082
|
value: C;
|
|
@@ -2187,7 +2136,7 @@ declare class QueryExpressions {
|
|
|
2187
2136
|
*
|
|
2188
2137
|
* @param arg - any available column name, such as of a joined table
|
|
2189
2138
|
*/
|
|
2190
|
-
ref<T extends
|
|
2139
|
+
ref<T extends PickQuerySelectable, K extends keyof T['__selectable'] & string>(this: T, arg: K): RefExpression<T['__selectable'][K]['column']> & T['__selectable'][K]['column']['operators'];
|
|
2191
2140
|
val(value: unknown): ValExpression;
|
|
2192
2141
|
/**
|
|
2193
2142
|
* `fn` allows to call an arbitrary SQL function.
|
|
@@ -2225,21 +2174,18 @@ declare class QueryExpressions {
|
|
|
2225
2174
|
* @param args
|
|
2226
2175
|
* @param options
|
|
2227
2176
|
*/
|
|
2228
|
-
fn<T extends
|
|
2177
|
+
fn<T extends PickQueryMetaSelectableResultRelationsWindowsColumnTypes, Type = unknown, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumnOfType<Type>>(this: T, fn: string, args: SelectableOrExpressions<T>, options?: AggregateOptions<T>): SetQueryReturnsFn<T, C>;
|
|
2229
2178
|
or(...args: [OrExpressionArg, ...OrExpressionArg[]]): OrExpression;
|
|
2230
2179
|
}
|
|
2231
2180
|
|
|
2232
2181
|
type QueryScopes<Keys extends string> = {
|
|
2233
2182
|
[K in Keys]: unknown;
|
|
2234
2183
|
};
|
|
2235
|
-
interface
|
|
2236
|
-
selectable: SelectableFromShape<Shape, Table>;
|
|
2237
|
-
}
|
|
2238
|
-
interface ScopeArgumentQuery<Table extends string | undefined, Shape extends Column.QueryColumns> extends Where, PickQueryMetaShapeRelationsWithData {
|
|
2184
|
+
interface ScopeArgumentQuery<Table extends string | undefined, Shape extends Column.QueryColumns> extends Where, PickQuerySelectableShapeRelationsWithData {
|
|
2239
2185
|
__isQuery: true;
|
|
2240
2186
|
table: Table;
|
|
2241
2187
|
shape: Shape;
|
|
2242
|
-
|
|
2188
|
+
__selectable: SelectableFromShape<Shape, Table>;
|
|
2243
2189
|
}
|
|
2244
2190
|
/**
|
|
2245
2191
|
* This feature allows defining a set of query modifiers to use it later.
|
|
@@ -2287,7 +2233,7 @@ declare class QueryScope {
|
|
|
2287
2233
|
*
|
|
2288
2234
|
* @param scope - name of the scope to apply
|
|
2289
2235
|
*/
|
|
2290
|
-
scope<T extends
|
|
2236
|
+
scope<T extends PickQueryScopes>(this: T, scope: keyof T['__scopes']): T & QueryHasWhere;
|
|
2291
2237
|
/**
|
|
2292
2238
|
* See {@link QueryScope}
|
|
2293
2239
|
*
|
|
@@ -2300,7 +2246,7 @@ declare class QueryScope {
|
|
|
2300
2246
|
*
|
|
2301
2247
|
* @param scope - name of the scope to remove from the query
|
|
2302
2248
|
*/
|
|
2303
|
-
unscope<T extends
|
|
2249
|
+
unscope<T extends PickQueryScopes>(this: T, scope: keyof T['__scopes']): T;
|
|
2304
2250
|
}
|
|
2305
2251
|
|
|
2306
2252
|
/**
|
|
@@ -2758,9 +2704,9 @@ interface DefaultSchemaConfig extends ColumnSchemaConfig<Column> {
|
|
|
2758
2704
|
declare const defaultSchemaConfig: DefaultSchemaConfig;
|
|
2759
2705
|
|
|
2760
2706
|
type DeleteMethodsNames = 'delete';
|
|
2761
|
-
type DeleteArgs<T extends
|
|
2762
|
-
type DeleteResult<T extends
|
|
2763
|
-
declare const _queryDelete: <T extends
|
|
2707
|
+
type DeleteArgs<T extends PickQueryHasWhere> = T['__hasWhere'] extends true ? EmptyTuple : [never];
|
|
2708
|
+
type DeleteResult<T extends PickQueryHasSelectResultReturnType> = T['__hasSelect'] extends true ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsRowCountMany<T> : SetQueryReturnsRowCount<T>;
|
|
2709
|
+
declare const _queryDelete: <T extends PickQueryHasSelectResultReturnType>(query: T) => DeleteResult<T>;
|
|
2764
2710
|
declare class Delete {
|
|
2765
2711
|
/**
|
|
2766
2712
|
* This method deletes one or more rows, based on other conditions specified in the query.
|
|
@@ -2821,14 +2767,15 @@ declare class Delete {
|
|
|
2821
2767
|
* .from('b');
|
|
2822
2768
|
* ```
|
|
2823
2769
|
*/
|
|
2824
|
-
delete<T extends
|
|
2770
|
+
delete<T extends PickQueryHasSelectHasWhereResultReturnType>(this: T, ..._args: DeleteArgs<T>): DeleteResult<T>;
|
|
2825
2771
|
}
|
|
2826
2772
|
|
|
2827
2773
|
type SoftDeleteOption<Shape extends Column.QueryColumns> = true | keyof Shape;
|
|
2828
|
-
interface QueryWithSoftDelete extends
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2774
|
+
interface QueryWithSoftDelete extends PickQueryResult, PickQueryReturnType, PickQueryHasSelect, PickQueryHasWhere {
|
|
2775
|
+
__scopes: NonDeletedScope;
|
|
2776
|
+
}
|
|
2777
|
+
interface NonDeletedScope {
|
|
2778
|
+
nonDeleted: true;
|
|
2832
2779
|
}
|
|
2833
2780
|
/**
|
|
2834
2781
|
* `softDelete` configures the table to set `deletedAt` to current time instead of deleting records.
|
|
@@ -2907,6 +2854,37 @@ declare class QueryLog {
|
|
|
2907
2854
|
log<T>(this: T, log?: boolean): T;
|
|
2908
2855
|
}
|
|
2909
2856
|
|
|
2857
|
+
interface QueryInternalColumnNameToKey {
|
|
2858
|
+
columnNameToKeyMap?: Map<string, string>;
|
|
2859
|
+
}
|
|
2860
|
+
/**
|
|
2861
|
+
* In snake case mode, or when columns have custom names,
|
|
2862
|
+
* use this method to exchange a db column name to its runtime key.
|
|
2863
|
+
*/
|
|
2864
|
+
declare const queryColumnNameToKey: (q: Query, name: string) => string | undefined;
|
|
2865
|
+
|
|
2866
|
+
interface QueryInternal<SinglePrimaryKey = any, UniqueColumns = any, UniqueColumnNames = any, UniqueColumnTuples = any, UniqueConstraints = any> extends QueryInternalColumnNameToKey {
|
|
2867
|
+
runtimeDefaultColumns?: string[];
|
|
2868
|
+
transactionStorage: AsyncLocalStorage<TransactionState>;
|
|
2869
|
+
scopes?: RecordUnknown;
|
|
2870
|
+
snakeCase?: boolean;
|
|
2871
|
+
noPrimaryKey: boolean;
|
|
2872
|
+
comment?: string;
|
|
2873
|
+
primaryKeys?: string[];
|
|
2874
|
+
singlePrimaryKey: SinglePrimaryKey;
|
|
2875
|
+
uniqueColumns: UniqueColumns;
|
|
2876
|
+
uniqueColumnNames: UniqueColumnNames;
|
|
2877
|
+
uniqueColumnTuples: UniqueColumnTuples;
|
|
2878
|
+
uniqueConstraints: UniqueConstraints;
|
|
2879
|
+
extensions?: DbExtension[];
|
|
2880
|
+
domains?: DbDomainArgRecord;
|
|
2881
|
+
generatorIgnore?: GeneratorIgnore;
|
|
2882
|
+
tableData: TableData;
|
|
2883
|
+
nowSQL?: string;
|
|
2884
|
+
callbackArg?: Query;
|
|
2885
|
+
selectAllCount: number;
|
|
2886
|
+
}
|
|
2887
|
+
|
|
2910
2888
|
type ShapeColumnPrimaryKeys<Shape extends Column.QueryColumnsInit> = {
|
|
2911
2889
|
[K in {
|
|
2912
2890
|
[K in keyof Shape]: Shape[K]['data']['primaryKey'] extends string ? K : never;
|
|
@@ -2979,20 +2957,10 @@ interface DbTableOptions<ColumnTypes, Table extends string | undefined, Shape ex
|
|
|
2979
2957
|
type DbTableOptionScopes<Table extends string | undefined, Shape extends Column.QueryColumns, Keys extends string = string> = {
|
|
2980
2958
|
[K in Keys]: (q: ScopeArgumentQuery<Table, Shape>) => IsQuery;
|
|
2981
2959
|
};
|
|
2982
|
-
interface TableMeta<Table extends string | undefined, Shape extends Column.QueryColumnsInit, ShapeWithComputed extends Column.QueryColumnsInit, Scopes extends RecordUnknown | undefined> extends QueryMetaBase<{
|
|
2983
|
-
[K in keyof Scopes]: true;
|
|
2984
|
-
}> {
|
|
2985
|
-
kind: 'select';
|
|
2986
|
-
defaults: {
|
|
2987
|
-
[K in keyof Shape as unknown extends Shape[K]['data']['default'] ? never : K]: true;
|
|
2988
|
-
};
|
|
2989
|
-
selectable: SelectableFromShape<ShapeWithComputed, Table>;
|
|
2990
|
-
defaultSelect: ColumnsShape.DefaultSelectKeys<Shape>;
|
|
2991
|
-
}
|
|
2992
2960
|
interface QueryBuilder extends Query {
|
|
2993
2961
|
returnType: undefined;
|
|
2994
2962
|
}
|
|
2995
|
-
declare class Db<Table extends string | undefined = undefined, Shape extends Column.QueryColumnsInit = Column.QueryColumnsInit, PrimaryKeys = never, UniqueColumns = never, UniqueColumnTuples = never, UniqueConstraints = never, ColumnTypes = DefaultColumnTypes<ColumnSchemaConfig>, ShapeWithComputed extends Column.QueryColumnsInit = Shape, Scopes extends RecordUnknown | undefined = EmptyObject> extends QueryMethods<ColumnTypes> implements Query {
|
|
2963
|
+
declare class Db<Table extends string | undefined = undefined, Shape extends Column.QueryColumnsInit = Column.QueryColumnsInit, PrimaryKeys = never, UniqueColumns = never, UniqueColumnTuples = never, UniqueConstraints = never, ColumnTypes = DefaultColumnTypes<ColumnSchemaConfig>, ShapeWithComputed extends Column.QueryColumnsInit = Shape, Scopes extends RecordUnknown | undefined = EmptyObject, DefaultSelect extends keyof Shape = keyof Shape> extends QueryMethods<ColumnTypes> implements Query {
|
|
2996
2964
|
adapter: AdapterBase;
|
|
2997
2965
|
qb: QueryBuilder;
|
|
2998
2966
|
table: Table;
|
|
@@ -3000,11 +2968,26 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
|
|
|
3000
2968
|
columnTypes: ColumnTypes;
|
|
3001
2969
|
q: QueryData;
|
|
3002
2970
|
__isQuery: true;
|
|
2971
|
+
__as: Table & string;
|
|
2972
|
+
__selectable: SelectableFromShape<ShapeWithComputed, Table>;
|
|
2973
|
+
__hasSelect: boolean;
|
|
2974
|
+
__hasWhere: boolean;
|
|
2975
|
+
__defaults: {
|
|
2976
|
+
[K in {
|
|
2977
|
+
[K in keyof Shape]: unknown extends Shape[K]['data']['default'] ? never : K;
|
|
2978
|
+
}[keyof Shape]]: true;
|
|
2979
|
+
};
|
|
2980
|
+
__scopes: {
|
|
2981
|
+
[K in keyof Scopes]: true;
|
|
2982
|
+
};
|
|
2983
|
+
__defaultSelect: DefaultSelect;
|
|
3003
2984
|
baseQuery: Query;
|
|
3004
2985
|
columns: (keyof Shape)[];
|
|
3005
2986
|
outputType: ColumnsShape.DefaultSelectOutput<Shape>;
|
|
3006
2987
|
inputType: ColumnsShape.Input<Shape>;
|
|
3007
|
-
result:
|
|
2988
|
+
result: {
|
|
2989
|
+
[K in DefaultSelect]: Shape[K];
|
|
2990
|
+
};
|
|
3008
2991
|
returnType: undefined;
|
|
3009
2992
|
then: QueryThenShallowSimplifyArr<ColumnsShape.DefaultOutput<Shape>>;
|
|
3010
2993
|
windows: EmptyObject;
|
|
@@ -3012,7 +2995,6 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
|
|
|
3012
2995
|
relationQueries: EmptyObject;
|
|
3013
2996
|
withData: EmptyObject;
|
|
3014
2997
|
error: new (message: string, length: number, name: QueryErrorName) => QueryError<this>;
|
|
3015
|
-
meta: TableMeta<Table, Shape, ShapeWithComputed, Scopes>;
|
|
3016
2998
|
internal: QueryInternal<{
|
|
3017
2999
|
[K in keyof PrimaryKeys]: (keyof PrimaryKeys extends K ? never : keyof PrimaryKeys) extends never ? PrimaryKeys[K] : never;
|
|
3018
3000
|
}[keyof PrimaryKeys], PrimaryKeys | UniqueColumns, {
|
|
@@ -3081,7 +3063,7 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
|
|
|
3081
3063
|
queryArrays<R extends any[] = any[]>(...args: SQLQueryArgs): Promise<QueryArraysResult<R>>;
|
|
3082
3064
|
}
|
|
3083
3065
|
interface DbTableConstructor<ColumnTypes> {
|
|
3084
|
-
<Table extends string, Shape extends Column.QueryColumnsInit, Data extends MaybeArray$1<TableDataItem>, Options extends DbTableOptions<ColumnTypes, Table, Shape>>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, tableData?: TableDataFn<Shape, Data>, options?: Options): Db<Table, Shape, keyof ShapeColumnPrimaryKeys<Shape> extends never ? never : ShapeColumnPrimaryKeys<Shape>, ShapeUniqueColumns<Shape> | TableDataItemsUniqueColumns<Shape, Data>, TableDataItemsUniqueColumnTuples<Shape, Data>, UniqueConstraints<Shape> | TableDataItemsUniqueConstraints<Data>, ColumnTypes, Shape & ComputedColumnsFromOptions<Options['computed']>, MapTableScopesOption<Options>> & {
|
|
3066
|
+
<Table extends string, Shape extends Column.QueryColumnsInit, Data extends MaybeArray$1<TableDataItem>, Options extends DbTableOptions<ColumnTypes, Table, Shape>>(table: Table, shape?: ((t: ColumnTypes) => Shape) | Shape, tableData?: TableDataFn<Shape, Data>, options?: Options): Db<Table, Shape, keyof ShapeColumnPrimaryKeys<Shape> extends never ? never : ShapeColumnPrimaryKeys<Shape>, ShapeUniqueColumns<Shape> | TableDataItemsUniqueColumns<Shape, Data>, TableDataItemsUniqueColumnTuples<Shape, Data>, UniqueConstraints<Shape> | TableDataItemsUniqueConstraints<Data>, ColumnTypes, Shape & ComputedColumnsFromOptions<Options['computed']>, MapTableScopesOption<Options>, ColumnsShape.DefaultSelectKeys<Shape>> & {
|
|
3085
3067
|
ko: Shape;
|
|
3086
3068
|
};
|
|
3087
3069
|
}
|
|
@@ -3089,9 +3071,7 @@ type MapTableScopesOption<T> = T extends {
|
|
|
3089
3071
|
scopes: RecordUnknown;
|
|
3090
3072
|
} ? T extends {
|
|
3091
3073
|
softDelete: true | PropertyKey;
|
|
3092
|
-
} ? T['scopes'] & {
|
|
3093
|
-
nonDeleted: unknown;
|
|
3094
|
-
} : T['scopes'] : T extends {
|
|
3074
|
+
} ? T['scopes'] & NonDeletedScope : T['scopes'] : T extends {
|
|
3095
3075
|
softDelete: true | PropertyKey;
|
|
3096
3076
|
} ? {
|
|
3097
3077
|
nonDeleted: unknown;
|
|
@@ -3251,22 +3231,22 @@ declare const performQuery: <Result = QueryResult<any>>(q: {
|
|
|
3251
3231
|
q: QueryData;
|
|
3252
3232
|
}, args: SQLQueryArgs, method: 'query' | 'arrays') => Promise<Result>;
|
|
3253
3233
|
|
|
3254
|
-
type WhereArg<T extends
|
|
3255
|
-
[K in keyof T['
|
|
3256
|
-
columns: (keyof T['
|
|
3234
|
+
type WhereArg<T extends PickQuerySelectableRelations> = {
|
|
3235
|
+
[K in keyof T['__selectable'] | 'NOT' | 'OR' | 'IN']?: K extends 'NOT' ? WhereArg<T> | WhereArgs<T> : K extends 'OR' ? (WhereArg<T> | WhereArgs<T>)[] : K extends 'IN' ? MaybeArray<{
|
|
3236
|
+
columns: (keyof T['__selectable'])[];
|
|
3257
3237
|
values: unknown[][] | IsQuery | Expression;
|
|
3258
|
-
}> : T['
|
|
3259
|
-
[O in keyof T['
|
|
3238
|
+
}> : T['__selectable'][K]['column']['queryType'] | null | {
|
|
3239
|
+
[O in keyof T['__selectable'][K]['column']['operators']]?: T['__selectable'][K]['column']['operators'][O]['_opType'];
|
|
3260
3240
|
} | {
|
|
3261
3241
|
result: {
|
|
3262
3242
|
value: {
|
|
3263
|
-
queryType: T['
|
|
3243
|
+
queryType: T['__selectable'][K]['column']['queryType'] | null;
|
|
3264
3244
|
};
|
|
3265
3245
|
};
|
|
3266
3246
|
} | ((q: T) => {
|
|
3267
3247
|
result: {
|
|
3268
3248
|
value: {
|
|
3269
|
-
queryType: T['
|
|
3249
|
+
queryType: T['__selectable'][K]['column']['queryType'] | null;
|
|
3270
3250
|
};
|
|
3271
3251
|
};
|
|
3272
3252
|
});
|
|
@@ -3280,42 +3260,37 @@ type WhereArg<T extends PickQueryMetaRelations> = {
|
|
|
3280
3260
|
* ```
|
|
3281
3261
|
*/
|
|
3282
3262
|
type WhereQueryBuilder<T extends PickQueryRelations> = EmptyObject extends T['relations'] ? {
|
|
3283
|
-
[K in keyof T]: K extends keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '
|
|
3263
|
+
[K in keyof T]: K extends keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '__selectable' | 'relations' | 'useHelper' | 'modify' | 'result' | 'returnType' | 'withData' | 'windows' | 'then' ? T[K] : never;
|
|
3284
3264
|
} : {
|
|
3285
|
-
[K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['query'] : K extends keyof T & (keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '
|
|
3265
|
+
[K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['query'] : K extends keyof T & (keyof Where | keyof QueryExpressions | 'table' | 'get' | 'columnTypes' | '__selectable' | 'relations' | 'useHelper' | 'modify' | 'result' | 'returnType' | 'withData' | 'windows' | 'then') ? T[K] : never;
|
|
3286
3266
|
};
|
|
3287
|
-
type WhereArgs<T extends
|
|
3288
|
-
type WhereNotArgs<T extends
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3267
|
+
type WhereArgs<T extends PickQuerySelectableRelations> = WhereArg<T>[];
|
|
3268
|
+
type WhereNotArgs<T extends PickQuerySelectableRelations> = [
|
|
3269
|
+
WhereArg<T>
|
|
3270
|
+
];
|
|
3271
|
+
type WhereInColumn<T extends PickQuerySelectableRelations> = keyof T['__selectable'] | [keyof T['__selectable'], ...(keyof T['__selectable'])[]];
|
|
3272
|
+
type WhereInValues<T extends PickQuerySelectableRelations, Column> = Column extends keyof T['__selectable'] ? Iterable<T['__selectable'][Column]['column']['queryType']> | IsQuery | Expression : ({
|
|
3273
|
+
[I in keyof Column]: Column[I] extends keyof T['__selectable'] ? T['__selectable'][Column[I]]['column']['queryType'] : never;
|
|
3292
3274
|
} & {
|
|
3293
3275
|
length: Column extends {
|
|
3294
3276
|
length: number;
|
|
3295
3277
|
} ? Column['length'] : never;
|
|
3296
3278
|
})[] | IsQuery | Expression;
|
|
3297
|
-
type WhereInArg<T extends
|
|
3298
|
-
[K in keyof T['
|
|
3279
|
+
type WhereInArg<T extends PickQuerySelectableRelations> = {
|
|
3280
|
+
[K in keyof T['__selectable']]?: Iterable<T['__selectable'][K]['column']['queryType']> | IsQuery | Expression;
|
|
3299
3281
|
};
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
meta: {
|
|
3303
|
-
hasWhere: true;
|
|
3304
|
-
};
|
|
3282
|
+
interface QueryHasWhere {
|
|
3283
|
+
__hasWhere: true;
|
|
3305
3284
|
}
|
|
3306
3285
|
interface QueryFnReturningSelect {
|
|
3307
|
-
(q: never):
|
|
3308
|
-
meta: {
|
|
3309
|
-
hasSelect: true;
|
|
3310
|
-
};
|
|
3311
|
-
};
|
|
3286
|
+
(q: never): QueryHasSelect;
|
|
3312
3287
|
}
|
|
3313
3288
|
/**
|
|
3314
3289
|
* Mutative {@link Where.prototype.where}
|
|
3315
3290
|
*/
|
|
3316
|
-
declare const _queryWhere: <T extends
|
|
3317
|
-
declare const _queryFindBy: <T extends
|
|
3318
|
-
declare const _queryFindByOptional: <T extends
|
|
3291
|
+
declare const _queryWhere: <T extends PickQuerySelectableRelations>(q: T, args: WhereArgs<T>) => T & QueryHasWhere;
|
|
3292
|
+
declare const _queryFindBy: <T extends PickQuerySelectableRelationsResultReturnType>(q: T, arg: WhereArg<T>) => QueryTake<T & QueryHasWhere>;
|
|
3293
|
+
declare const _queryFindByOptional: <T extends PickQuerySelectableRelationsResultReturnType>(q: T, arg: WhereArg<T>) => QueryTakeOptional<T & QueryHasWhere>;
|
|
3319
3294
|
/**
|
|
3320
3295
|
* Mutative {@link Where.prototype.whereSql}
|
|
3321
3296
|
*/
|
|
@@ -3323,7 +3298,7 @@ declare const _queryWhereSql: <T>(q: T, args: SQLQueryArgs) => T;
|
|
|
3323
3298
|
/**
|
|
3324
3299
|
* Mutative {@link Where.prototype.whereNot}
|
|
3325
3300
|
*/
|
|
3326
|
-
declare const _queryWhereNot: <T extends
|
|
3301
|
+
declare const _queryWhereNot: <T extends PickQuerySelectableRelations>(q: T, args: WhereNotArgs<T>) => T & QueryHasWhere;
|
|
3327
3302
|
/**
|
|
3328
3303
|
* Mutative {@link Where.prototype.whereNotSql}
|
|
3329
3304
|
*/
|
|
@@ -3332,24 +3307,24 @@ declare const _queryWhereNotSql: <T>(q: T, args: SQLQueryArgs) => T;
|
|
|
3332
3307
|
* Mutative {@link Where.prototype.whereNotExists}
|
|
3333
3308
|
*/
|
|
3334
3309
|
declare const _queryWhereNotExists: (q: Query, arg: unknown, args: unknown) => never;
|
|
3335
|
-
declare const _queryWhereOneOf: <T extends
|
|
3336
|
-
declare const _queryWhereNotOneOf: <T extends
|
|
3310
|
+
declare const _queryWhereOneOf: <T extends PickQuerySelectableRelations>(q: T, args: WhereArgs<T>) => T;
|
|
3311
|
+
declare const _queryWhereNotOneOf: <T extends PickQuerySelectableRelations>(q: T, args: WhereArgs<T>) => T;
|
|
3337
3312
|
/**
|
|
3338
3313
|
* Mutative {@link Where.prototype.orWhere}
|
|
3339
3314
|
*/
|
|
3340
|
-
declare const _queryOr: <T extends
|
|
3315
|
+
declare const _queryOr: <T extends PickQuerySelectableRelations>(q: T, args: WhereArgs<T>) => T & QueryHasWhere;
|
|
3341
3316
|
/**
|
|
3342
3317
|
* Mutative {@link Where.prototype.orWhereNot}
|
|
3343
3318
|
*/
|
|
3344
|
-
declare const _queryOrNot: <T extends
|
|
3319
|
+
declare const _queryOrNot: <T extends PickQuerySelectableRelations>(q: T, args: WhereArgs<T>) => T & QueryHasWhere;
|
|
3345
3320
|
/**
|
|
3346
3321
|
* Mutative {@link Where.prototype.whereIn}
|
|
3347
3322
|
*/
|
|
3348
|
-
declare const _queryWhereIn: <T>(q: T, and: boolean, arg: unknown, values: unknown[] | Iterable<unknown> | IsQuery | Expression | undefined, not?: boolean) =>
|
|
3323
|
+
declare const _queryWhereIn: <T>(q: T, and: boolean, arg: unknown, values: unknown[] | Iterable<unknown> | IsQuery | Expression | undefined, not?: boolean) => T & QueryHasWhere;
|
|
3349
3324
|
/**
|
|
3350
3325
|
* Mutative {@link Where.prototype.whereExists}
|
|
3351
3326
|
*/
|
|
3352
|
-
declare const _queryWhereExists: <T extends
|
|
3327
|
+
declare const _queryWhereExists: <T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>>(q: T, arg: Arg, args: JoinArgs<T, Arg>) => T & QueryHasWhere;
|
|
3353
3328
|
declare class Where {
|
|
3354
3329
|
/**
|
|
3355
3330
|
* Constructing `WHERE` conditions:
|
|
@@ -3731,7 +3706,7 @@ declare class Where {
|
|
|
3731
3706
|
*
|
|
3732
3707
|
* @param args - {@link WhereArgs}
|
|
3733
3708
|
*/
|
|
3734
|
-
where<T extends
|
|
3709
|
+
where<T extends PickQuerySelectableRelations>(this: T, ...args: WhereArgs<T>): T & QueryHasWhere;
|
|
3735
3710
|
/**
|
|
3736
3711
|
* Use a custom SQL expression in `WHERE` statement:
|
|
3737
3712
|
*
|
|
@@ -3757,7 +3732,7 @@ declare class Where {
|
|
|
3757
3732
|
*
|
|
3758
3733
|
* @param args - {@link WhereArgs}
|
|
3759
3734
|
*/
|
|
3760
|
-
whereNot<T extends
|
|
3735
|
+
whereNot<T extends PickQuerySelectableRelations>(this: T, ...args: WhereNotArgs<T>): T & QueryHasWhere;
|
|
3761
3736
|
/**
|
|
3762
3737
|
* `whereNotSql` is a version of `whereNot` accepting SQL expression:
|
|
3763
3738
|
*
|
|
@@ -3795,7 +3770,7 @@ declare class Where {
|
|
|
3795
3770
|
*
|
|
3796
3771
|
* @param args - same arguments as in {@link where}, joined with `OR`
|
|
3797
3772
|
*/
|
|
3798
|
-
whereOneOf<T extends
|
|
3773
|
+
whereOneOf<T extends PickQuerySelectableRelations>(this: T, ...args: WhereArgs<T>): T;
|
|
3799
3774
|
/**
|
|
3800
3775
|
* Negative {@link whereOneOf}:
|
|
3801
3776
|
*
|
|
@@ -3810,7 +3785,7 @@ declare class Where {
|
|
|
3810
3785
|
*
|
|
3811
3786
|
* @param args - same arguments as in {@link where}, joined with `OR`
|
|
3812
3787
|
*/
|
|
3813
|
-
whereNotOneOf<T extends
|
|
3788
|
+
whereNotOneOf<T extends PickQuerySelectableRelations>(this: T, ...args: WhereArgs<T>): T;
|
|
3814
3789
|
/**
|
|
3815
3790
|
* `orWhere` stands for "...**or** where one of the given is true".
|
|
3816
3791
|
*
|
|
@@ -3829,13 +3804,13 @@ declare class Where {
|
|
|
3829
3804
|
*
|
|
3830
3805
|
* @param args - same arguments as in {@link where}, joined with `OR`
|
|
3831
3806
|
*/
|
|
3832
|
-
orWhere<T extends
|
|
3807
|
+
orWhere<T extends PickQuerySelectableRelations>(this: T, ...args: WhereArgs<T>): T & QueryHasWhere;
|
|
3833
3808
|
/**
|
|
3834
3809
|
* `orWhereNot` takes the same arguments as {@link orWhere}, and prepends each condition with `NOT` just as {@link whereNot} does.
|
|
3835
3810
|
*
|
|
3836
3811
|
* @param args - {@link WhereArgs} will be prefixed with `NOT` and joined with `OR`
|
|
3837
3812
|
*/
|
|
3838
|
-
orWhereNot<T extends
|
|
3813
|
+
orWhereNot<T extends PickQuerySelectableRelations>(this: T, ...args: WhereArgs<T>): T & QueryHasWhere;
|
|
3839
3814
|
/**
|
|
3840
3815
|
* `whereIn` and related methods are for the `IN` operator to check for inclusion in a list of values.
|
|
3841
3816
|
*
|
|
@@ -3882,7 +3857,7 @@ declare class Where {
|
|
|
3882
3857
|
* db.table.whereIn({ id: [] })
|
|
3883
3858
|
* ```
|
|
3884
3859
|
*/
|
|
3885
|
-
whereIn<T extends
|
|
3860
|
+
whereIn<T extends PickQuerySelectableRelations, Column extends WhereInColumn<T>>(this: T, ...args: [column: Column, values: WhereInValues<T, Column>] | [arg: WhereInArg<T>]): T & QueryHasWhere;
|
|
3886
3861
|
/**
|
|
3887
3862
|
* Takes the same arguments as {@link whereIn}.
|
|
3888
3863
|
* Add a `WHERE IN` condition prefixed with `OR` to the query:
|
|
@@ -3891,7 +3866,7 @@ declare class Where {
|
|
|
3891
3866
|
* db.table.whereIn('a', [1, 2, 3]).orWhereIn('b', ['one', 'two']);
|
|
3892
3867
|
* ```
|
|
3893
3868
|
*/
|
|
3894
|
-
orWhereIn<T extends
|
|
3869
|
+
orWhereIn<T extends PickQuerySelectableRelations, Column extends WhereInColumn<T>>(this: T, ...args: [column: Column, values: WhereInValues<T, Column>] | [WhereInArg<T>]): T & QueryHasWhere;
|
|
3895
3870
|
/**
|
|
3896
3871
|
* Acts as `whereIn`, but negates the condition with `NOT`:
|
|
3897
3872
|
*
|
|
@@ -3899,7 +3874,7 @@ declare class Where {
|
|
|
3899
3874
|
* db.table.whereNotIn('color', ['red', 'green', 'blue']);
|
|
3900
3875
|
* ```
|
|
3901
3876
|
*/
|
|
3902
|
-
whereNotIn<T extends
|
|
3877
|
+
whereNotIn<T extends PickQuerySelectableRelations, Column extends WhereInColumn<T>>(this: T, ...args: [column: Column, values: WhereInValues<T, Column>] | [arg: WhereInArg<T>]): T & QueryHasWhere;
|
|
3903
3878
|
/**
|
|
3904
3879
|
* Acts as `whereIn`, but prepends `OR` to the condition and negates it with `NOT`:
|
|
3905
3880
|
*
|
|
@@ -3907,7 +3882,7 @@ declare class Where {
|
|
|
3907
3882
|
* db.table.whereNotIn('a', [1, 2, 3]).orWhereNoIn('b', ['one', 'two']);
|
|
3908
3883
|
* ```
|
|
3909
3884
|
*/
|
|
3910
|
-
orWhereNotIn<T extends
|
|
3885
|
+
orWhereNotIn<T extends PickQuerySelectableRelations, Column extends WhereInColumn<T>>(this: T, ...args: [column: Column, values: WhereInValues<T, Column>] | [arg: WhereInArg<T>]): T & QueryHasWhere;
|
|
3911
3886
|
/**
|
|
3912
3887
|
* `whereExists` is for support of the `WHERE EXISTS (query)` clause.
|
|
3913
3888
|
*
|
|
@@ -3929,11 +3904,11 @@ declare class Where {
|
|
|
3929
3904
|
* db.user.whereExists(db.account, (q) => q.on('account.id', '=', 'user.id'));
|
|
3930
3905
|
* ```
|
|
3931
3906
|
*/
|
|
3932
|
-
whereExists<T extends
|
|
3907
|
+
whereExists<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): Arg extends QueryFnReturningSelect ? {
|
|
3933
3908
|
error: 'Cannot select in whereExists';
|
|
3934
3909
|
} : Args[0] extends QueryFnReturningSelect ? {
|
|
3935
3910
|
error: 'Cannot select in whereExists';
|
|
3936
|
-
} :
|
|
3911
|
+
} : T & QueryHasWhere;
|
|
3937
3912
|
/**
|
|
3938
3913
|
* Acts as `whereExists`, but prepends the condition with `OR`:
|
|
3939
3914
|
*
|
|
@@ -3943,7 +3918,7 @@ declare class Where {
|
|
|
3943
3918
|
* db.user.whereExist('account').orWhereExists('profile');
|
|
3944
3919
|
* ```
|
|
3945
3920
|
*/
|
|
3946
|
-
orWhereExists<T extends
|
|
3921
|
+
orWhereExists<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>>(this: T, arg: Arg, ...args: JoinArgs<T, Arg>): T & QueryHasWhere;
|
|
3947
3922
|
/**
|
|
3948
3923
|
* Acts as `whereExists`, but negates the condition with `NOT`:
|
|
3949
3924
|
*
|
|
@@ -3956,7 +3931,7 @@ declare class Where {
|
|
|
3956
3931
|
* @param arg - relation name, or a query object, or a `with` table alias, or a callback returning a query object.
|
|
3957
3932
|
* @param args - no arguments needed when the first argument is a relation name, or conditions to join the table with.
|
|
3958
3933
|
*/
|
|
3959
|
-
whereNotExists<T extends
|
|
3934
|
+
whereNotExists<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>>(this: T, arg: Arg, ...args: JoinArgs<T, Arg>): T & QueryHasWhere;
|
|
3960
3935
|
/**
|
|
3961
3936
|
* Acts as `whereExists`, but prepends the condition with `OR` and negates it with `NOT`:
|
|
3962
3937
|
*
|
|
@@ -3966,7 +3941,7 @@ declare class Where {
|
|
|
3966
3941
|
* db.user.whereNotExists('account').orWhereNotExists('profile');
|
|
3967
3942
|
* ```
|
|
3968
3943
|
*/
|
|
3969
|
-
orWhereNotExists<T extends
|
|
3944
|
+
orWhereNotExists<T extends PickQuerySelectableShapeRelationsWithDataAs, Arg extends JoinFirstArg<T>>(this: T, arg: Arg, ...args: JoinArgs<T, Arg>): T & QueryHasWhere;
|
|
3970
3945
|
}
|
|
3971
3946
|
|
|
3972
3947
|
type SortDir = 'ASC' | 'DESC' | 'ASC NULLS FIRST' | 'DESC NULLS LAST';
|
|
@@ -4024,15 +3999,16 @@ declare const searchSourcesToSql: (ctx: ToSQLCtx, data: QueryData, sources: Quer
|
|
|
4024
3999
|
declare const getSearchLang: (ctx: ToSQLCtx, data: QueryData, source: QuerySourceItem, quotedAs?: string) => string;
|
|
4025
4000
|
declare const getSearchText: (ctx: ToSQLCtx, data: QueryData, source: QuerySourceItem, quotedAs?: string, forHeadline?: boolean) => MaybeArray<string>;
|
|
4026
4001
|
|
|
4027
|
-
|
|
4002
|
+
interface OrderArgSelf extends PickQuerySelectable, PickQueryResult, PickQueryTsQuery {
|
|
4003
|
+
}
|
|
4028
4004
|
type OrderArg<T extends OrderArgSelf> = OrderArgKey<T> | OrderArgTsQuery<T> | {
|
|
4029
4005
|
[K in OrderArgKey<T> | OrderArgTsQuery<T>]?: K extends OrderArgTsQuery<T> ? OrderTsQueryConfig : SortDir;
|
|
4030
4006
|
} | Expression;
|
|
4031
4007
|
type OrderArgs<T extends OrderArgSelf> = OrderArg<T>[];
|
|
4032
|
-
type OrderArgTsQuery<T extends OrderArgSelf> = string | undefined extends T['
|
|
4008
|
+
type OrderArgTsQuery<T extends OrderArgSelf> = string | undefined extends T['__tsQuery'] ? never : Exclude<T['__tsQuery'], undefined>;
|
|
4033
4009
|
type OrderArgKey<T extends OrderArgSelf> = {
|
|
4034
|
-
[K in keyof T['
|
|
4035
|
-
}[keyof T['
|
|
4010
|
+
[K in keyof T['__selectable']]: T['__selectable'][K]['column']['queryType'] extends undefined ? never : K;
|
|
4011
|
+
}[keyof T['__selectable']] | {
|
|
4036
4012
|
[K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K;
|
|
4037
4013
|
}[keyof T['result']];
|
|
4038
4014
|
declare class QueryOrder {
|
|
@@ -4128,7 +4104,7 @@ declare class QueryWindow {
|
|
|
4128
4104
|
window<T extends OrderArgSelf, W extends WindowArg<T>>(this: T, arg: W): WindowResult<T, W>;
|
|
4129
4105
|
}
|
|
4130
4106
|
|
|
4131
|
-
interface AggregateOptions<T extends
|
|
4107
|
+
interface AggregateOptions<T extends PickQuerySelectableResultRelationsWindows> {
|
|
4132
4108
|
distinct?: boolean;
|
|
4133
4109
|
order?: OrderArg<T> | OrderArgs<T>;
|
|
4134
4110
|
filter?: WhereArg<T>;
|
|
@@ -4136,9 +4112,9 @@ interface AggregateOptions<T extends PickQueryMetaResultRelationsWindows> {
|
|
|
4136
4112
|
withinGroup?: boolean;
|
|
4137
4113
|
over?: Over<T>;
|
|
4138
4114
|
}
|
|
4139
|
-
type Over<T extends
|
|
4140
|
-
type FnExpressionArgs<Q extends
|
|
4141
|
-
interface FnExpressionArgsPairs<Q extends
|
|
4115
|
+
type Over<T extends PickQuerySelectableResultWindows> = keyof T['windows'] | WindowArgDeclaration<T>;
|
|
4116
|
+
type FnExpressionArgs<Q extends PickQuerySelectable> = (SelectableOrExpression<Q> | FnExpressionArgsPairs<Q> | FnExpressionArgsValue)[];
|
|
4117
|
+
interface FnExpressionArgsPairs<Q extends PickQuerySelectable> {
|
|
4142
4118
|
pairs: {
|
|
4143
4119
|
[K: string]: SelectableOrExpression<Q>;
|
|
4144
4120
|
};
|
|
@@ -4165,11 +4141,11 @@ declare class FnExpression<Q extends Query = Query, T extends Column.Pick.QueryC
|
|
|
4165
4141
|
constructor(query: Q, fn: string, args: FnExpressionArgs<Q>, options: AggregateOptions<Q>, value: T);
|
|
4166
4142
|
makeSQL(ctx: ToSQLCtx, quotedAs?: string): string;
|
|
4167
4143
|
}
|
|
4168
|
-
declare function makeFnExpression<T extends
|
|
4144
|
+
declare function makeFnExpression<T extends PickQuerySelectableResultRelationsWindows, C extends Column.Pick.QueryColumn>(self: T, type: C, fn: string, args: FnExpressionArgs<Query>, options?: AggregateOptions<T>): SetQueryReturnsColumnOrThrow<T, C> & C['operators'];
|
|
4169
4145
|
|
|
4170
|
-
type QueryGetSelf =
|
|
4146
|
+
type QueryGetSelf = PickQuerySelectable;
|
|
4171
4147
|
type GetArg<T extends QueryGetSelf> = GetStringArg<T> | Expression;
|
|
4172
|
-
type GetStringArg<T extends
|
|
4148
|
+
type GetStringArg<T extends PickQuerySelectable> = keyof T['__selectable'] & string;
|
|
4173
4149
|
type GetResult<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOrThrow<T, Arg> : Arg extends Expression ? SetQueryReturnsColumnOrThrow<T, Arg['result']['value']> : never;
|
|
4174
4150
|
type GetResultOptional<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOptional<T, Arg> : Arg extends Expression ? SetQueryReturnsColumnOptional<T, Arg['result']['value']> : never;
|
|
4175
4151
|
|
|
@@ -4178,25 +4154,25 @@ interface OperatorsCount extends OperatorsNumber {
|
|
|
4178
4154
|
}
|
|
4179
4155
|
type CountColumn = Column.Pick.QueryColumnOfTypeAndOps<'int8', number, OperatorsCount>;
|
|
4180
4156
|
type CountReturn<T> = SetQueryReturnsColumnOrThrow<T, CountColumn> & OperatorsCount;
|
|
4181
|
-
type SelectableDataType<T extends
|
|
4182
|
-
[K in keyof T['
|
|
4183
|
-
}[keyof T['
|
|
4184
|
-
type NumericReturn<T extends
|
|
4157
|
+
type SelectableDataType<T extends PickQuerySelectable, DataType extends string> = {
|
|
4158
|
+
[K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends DataType ? K : never;
|
|
4159
|
+
}[keyof T['__selectable']] | Expression<Column.Pick.QueryColumnOfDataType<DataType>>;
|
|
4160
|
+
type NumericReturn<T extends PickQuerySelectable, Arg> = Arg extends keyof T['__selectable'] ? SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfTypeAndOps<T['__selectable'][Arg]['column']['dataType'], T['__selectable'][Arg]['column']['type'] | null, OperatorsNumber>> & OperatorsNumber : Arg extends Expression ? SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfTypeAndOps<Arg['result']['value']['dataType'], Arg['result']['value']['type'] | null, OperatorsNumber>> & OperatorsNumber : never;
|
|
4185
4161
|
type NullableNumberReturn<T, DataType> = SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfTypeAndOps<DataType, number | null, OperatorsNumber>> & OperatorsNumber;
|
|
4186
4162
|
type BooleanQueryColumn = Column.Pick.QueryColumnOfTypeAndOps<'bool', boolean, OperatorsBoolean>;
|
|
4187
4163
|
type BooleanNullable = Column.Pick.QueryColumnOfTypeAndOps<'bool', boolean | null, OperatorsBoolean>;
|
|
4188
4164
|
type NullableBooleanReturn<T> = SetQueryReturnsColumnOrThrow<T, BooleanNullable> & OperatorsBoolean;
|
|
4189
|
-
type NullableJSONAggReturn<T extends
|
|
4165
|
+
type NullableJSONAggReturn<T extends PickQuerySelectable, Arg extends SelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
|
|
4190
4166
|
dataType: 'json';
|
|
4191
4167
|
type: (ExpressionOutput<T, Arg>['type'] | null)[] | null;
|
|
4192
4168
|
outputType: (ExpressionOutput<T, Arg>['outputType'] | null)[] | null;
|
|
4193
4169
|
queryType: (ExpressionOutput<T, Arg>['queryType'] | null)[] | null;
|
|
4194
4170
|
operators: OperatorsArray<never>;
|
|
4195
4171
|
}> & OperatorsArray<never>;
|
|
4196
|
-
interface RecordSelectableOrExpression<T extends
|
|
4172
|
+
interface RecordSelectableOrExpression<T extends PickQuerySelectable> {
|
|
4197
4173
|
[K: string]: SelectableOrExpression<T>;
|
|
4198
4174
|
}
|
|
4199
|
-
type NullableJSONObjectReturn<T extends
|
|
4175
|
+
type NullableJSONObjectReturn<T extends PickQuerySelectable, Obj extends RecordSelectableOrExpression<T>> = SetQueryReturnsColumnOrThrow<T, {
|
|
4200
4176
|
dataType: 'json';
|
|
4201
4177
|
type: {
|
|
4202
4178
|
[K in keyof Obj]: ExpressionOutput<T, Obj[K]>['type'];
|
|
@@ -4256,7 +4232,7 @@ declare class AggregateMethods {
|
|
|
4256
4232
|
* @param arg - optionally, provide a column or a raw SQL for the `count` argument
|
|
4257
4233
|
* @param options - aggregation options
|
|
4258
4234
|
*/
|
|
4259
|
-
count<T extends
|
|
4235
|
+
count<T extends PickQuerySelectableResultRelationsWindows>(this: T, arg?: SelectableOrExpression<T>, options?: AggregateOptions<T>): CountReturn<T>;
|
|
4260
4236
|
/**
|
|
4261
4237
|
* Get the minimum value for the specified numeric column, returns number or `null` if there are no records.
|
|
4262
4238
|
*
|
|
@@ -4278,7 +4254,7 @@ declare class AggregateMethods {
|
|
|
4278
4254
|
* @param arg - numeric column or raw SQL
|
|
4279
4255
|
* @param options - aggregation options
|
|
4280
4256
|
*/
|
|
4281
|
-
min<T extends
|
|
4257
|
+
min<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableDataType<T, AggregateArgTypes['minMax']>>(this: T, arg: Arg, options?: AggregateOptions<T>): NumericReturn<T, Arg>;
|
|
4282
4258
|
/**
|
|
4283
4259
|
* Gets the maximum value for the specified numeric column, returns number or `null` if there are no records.
|
|
4284
4260
|
*
|
|
@@ -4300,7 +4276,7 @@ declare class AggregateMethods {
|
|
|
4300
4276
|
* @param arg - numeric column or raw SQL
|
|
4301
4277
|
* @param options - aggregation options
|
|
4302
4278
|
*/
|
|
4303
|
-
max<T extends
|
|
4279
|
+
max<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableDataType<T, AggregateArgTypes['minMax']>>(this: T, arg: Arg, options?: AggregateOptions<T>): NumericReturn<T, Arg>;
|
|
4304
4280
|
/**
|
|
4305
4281
|
* Retrieve the sum of the values of a given numeric column, returns number or `null` if there are no records.
|
|
4306
4282
|
*
|
|
@@ -4321,7 +4297,7 @@ declare class AggregateMethods {
|
|
|
4321
4297
|
* @param arg - numeric column or raw SQL
|
|
4322
4298
|
* @param options - aggregation options
|
|
4323
4299
|
*/
|
|
4324
|
-
sum<T extends
|
|
4300
|
+
sum<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableDataType<T, AggregateArgTypes['sum']>>(this: T, arg: Arg, options?: AggregateOptions<T>): NumericReturn<T, Arg>;
|
|
4325
4301
|
/**
|
|
4326
4302
|
* Retrieve the average value of a numeric column, it returns a number or `null` if there are no records.
|
|
4327
4303
|
*
|
|
@@ -4339,7 +4315,7 @@ declare class AggregateMethods {
|
|
|
4339
4315
|
* @param arg - numeric column or raw SQL
|
|
4340
4316
|
* @param options - aggregation options
|
|
4341
4317
|
*/
|
|
4342
|
-
avg<T extends
|
|
4318
|
+
avg<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableDataType<T, AggregateArgTypes['avg']>>(this: T, arg: Arg, options?: AggregateOptions<T>): NumericReturn<T, Arg>;
|
|
4343
4319
|
/**
|
|
4344
4320
|
* Bitwise `and` aggregation, returns `number` or `null` if there are no records.
|
|
4345
4321
|
*
|
|
@@ -4360,7 +4336,7 @@ declare class AggregateMethods {
|
|
|
4360
4336
|
* @param arg - numeric column or raw SQL
|
|
4361
4337
|
* @param options - aggregation options
|
|
4362
4338
|
*/
|
|
4363
|
-
bitAnd<T extends
|
|
4339
|
+
bitAnd<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableDataType<T, AggregateArgTypes['bit']>>(this: T, arg: Arg, options?: AggregateOptions<T>): NumericReturn<T, Arg>;
|
|
4364
4340
|
/**
|
|
4365
4341
|
* Bitwise `or` aggregation, returns `number` or `null` if there are no records.
|
|
4366
4342
|
*
|
|
@@ -4378,7 +4354,7 @@ declare class AggregateMethods {
|
|
|
4378
4354
|
* @param arg - numeric column or raw SQL
|
|
4379
4355
|
* @param options - aggregation options
|
|
4380
4356
|
*/
|
|
4381
|
-
bitOr<T extends
|
|
4357
|
+
bitOr<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableDataType<T, AggregateArgTypes['bit']>>(this: T, arg: Arg, options?: AggregateOptions<T>): NumericReturn<T, Arg>;
|
|
4382
4358
|
/**
|
|
4383
4359
|
* Aggregate booleans with `and` logic, it returns `boolean` or `null` if there are no records.
|
|
4384
4360
|
*
|
|
@@ -4399,7 +4375,7 @@ declare class AggregateMethods {
|
|
|
4399
4375
|
* @param arg - boolean column or raw SQL
|
|
4400
4376
|
* @param options - aggregation options
|
|
4401
4377
|
*/
|
|
4402
|
-
boolAnd<T extends
|
|
4378
|
+
boolAnd<T extends PickQuerySelectableResultRelationsWindows>(this: T, arg: SelectableDataType<T, AggregateArgTypes['bool']>, options?: AggregateOptions<T>): NullableBooleanReturn<T>;
|
|
4403
4379
|
/**
|
|
4404
4380
|
* Aggregate booleans with `or` logic, it returns `boolean` or `null` if there are no records.
|
|
4405
4381
|
*
|
|
@@ -4420,11 +4396,11 @@ declare class AggregateMethods {
|
|
|
4420
4396
|
* @param arg - boolean column or raw SQL
|
|
4421
4397
|
* @param options - aggregation options
|
|
4422
4398
|
*/
|
|
4423
|
-
boolOr<T extends
|
|
4399
|
+
boolOr<T extends PickQuerySelectableResultRelationsWindows>(this: T, arg: SelectableDataType<T, AggregateArgTypes['bool']>, options?: AggregateOptions<T>): NullableBooleanReturn<T>;
|
|
4424
4400
|
/**
|
|
4425
4401
|
* Equivalent to {@link boolAnd}
|
|
4426
4402
|
*/
|
|
4427
|
-
every<T extends
|
|
4403
|
+
every<T extends PickQuerySelectableResultRelationsWindows>(this: T, arg: SelectableDataType<T, AggregateArgTypes['bool']>, options?: AggregateOptions<T>): NullableBooleanReturn<T>;
|
|
4428
4404
|
/**
|
|
4429
4405
|
* Aggregate values into an array by using `json_agg`. Returns array of values or `null` if there are no records.
|
|
4430
4406
|
*
|
|
@@ -4449,11 +4425,11 @@ declare class AggregateMethods {
|
|
|
4449
4425
|
* @param arg - any column or raw SQL
|
|
4450
4426
|
* @param options - aggregation options
|
|
4451
4427
|
*/
|
|
4452
|
-
jsonAgg<T extends
|
|
4428
|
+
jsonAgg<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableOrExpression<T>>(this: T, arg: Arg, options?: AggregateOptions<T>): NullableJSONAggReturn<T, Arg>;
|
|
4453
4429
|
/**
|
|
4454
4430
|
* See {@link jsonAgg}
|
|
4455
4431
|
*/
|
|
4456
|
-
jsonbAgg<T extends
|
|
4432
|
+
jsonbAgg<T extends PickQuerySelectableResultRelationsWindows, Arg extends SelectableOrExpression<T>>(this: T, arg: Arg, options?: AggregateOptions<T>): NullableJSONAggReturn<T, Arg>;
|
|
4457
4433
|
/**
|
|
4458
4434
|
* It does the construction of JSON objects, keys are provided strings and values can be table columns or raw SQL expressions, and returns `object` or `null` if no records.
|
|
4459
4435
|
*
|
|
@@ -4486,11 +4462,11 @@ declare class AggregateMethods {
|
|
|
4486
4462
|
* @param arg - object where values are column names or SQL
|
|
4487
4463
|
* @param options - aggregation options
|
|
4488
4464
|
*/
|
|
4489
|
-
jsonObjectAgg<T extends
|
|
4465
|
+
jsonObjectAgg<T extends PickQuerySelectableResultRelationsWindows, Obj extends RecordSelectableOrExpression<T>>(this: T, arg: Obj, options?: AggregateOptions<T>): NullableJSONObjectReturn<T, Obj>;
|
|
4490
4466
|
/**
|
|
4491
4467
|
* See {@link jsonObjectAgg}
|
|
4492
4468
|
*/
|
|
4493
|
-
jsonbObjectAgg<T extends
|
|
4469
|
+
jsonbObjectAgg<T extends PickQuerySelectableResultRelationsWindows, Obj extends RecordSelectableOrExpression<T>>(this: T, arg: Obj, options?: AggregateOptions<T>): NullableJSONObjectReturn<T, Obj>;
|
|
4494
4470
|
/**
|
|
4495
4471
|
* Select joined strings, it returns a string or `null` if no records.
|
|
4496
4472
|
*
|
|
@@ -4513,7 +4489,7 @@ declare class AggregateMethods {
|
|
|
4513
4489
|
* @param delimiter - string to join with
|
|
4514
4490
|
* @param options - aggration options
|
|
4515
4491
|
*/
|
|
4516
|
-
stringAgg<T extends
|
|
4492
|
+
stringAgg<T extends PickQuerySelectableResultRelationsWindows>(this: T, arg: SelectableDataType<T, AggregateArgTypes['stringAgg']>, delimiter: string, options?: AggregateOptions<T>): NullableStringReturn<T>;
|
|
4517
4493
|
/**
|
|
4518
4494
|
* Concatenates `xml` columns, returns a `string` or `null` if no records.
|
|
4519
4495
|
*
|
|
@@ -4531,7 +4507,7 @@ declare class AggregateMethods {
|
|
|
4531
4507
|
* @param arg - column or SQL with XML
|
|
4532
4508
|
* @param options - aggregation options
|
|
4533
4509
|
*/
|
|
4534
|
-
xmlAgg<T extends
|
|
4510
|
+
xmlAgg<T extends PickQuerySelectableResultRelationsWindows>(this: T, arg: SelectableOrExpressionOfType<T, StringColumn>, options?: AggregateOptions<T>): NullableStringReturn<T>;
|
|
4535
4511
|
/**
|
|
4536
4512
|
* Selects the` row_number` window function.
|
|
4537
4513
|
*
|
|
@@ -4550,7 +4526,7 @@ declare class AggregateMethods {
|
|
|
4550
4526
|
*
|
|
4551
4527
|
* @param over - OVER clause config
|
|
4552
4528
|
*/
|
|
4553
|
-
rowNumber<T extends
|
|
4529
|
+
rowNumber<T extends PickQuerySelectableResultRelationsWindows>(this: T, over?: Over<T>): NullableNumberReturn<T, 'int8'>;
|
|
4554
4530
|
/**
|
|
4555
4531
|
* Selects the` rank` window function.
|
|
4556
4532
|
*
|
|
@@ -4569,7 +4545,7 @@ declare class AggregateMethods {
|
|
|
4569
4545
|
*
|
|
4570
4546
|
* @param over - OVER clause config
|
|
4571
4547
|
*/
|
|
4572
|
-
rank<T extends
|
|
4548
|
+
rank<T extends PickQuerySelectableResultRelationsWindows>(this: T, over?: Over<T>): NullableNumberReturn<T, 'int8'>;
|
|
4573
4549
|
/**
|
|
4574
4550
|
* Selects the` dense_rank` window function.
|
|
4575
4551
|
*
|
|
@@ -4588,7 +4564,7 @@ declare class AggregateMethods {
|
|
|
4588
4564
|
*
|
|
4589
4565
|
* @param over - OVER clause config
|
|
4590
4566
|
*/
|
|
4591
|
-
denseRank<T extends
|
|
4567
|
+
denseRank<T extends PickQuerySelectableResultRelationsWindows>(this: T, over?: Over<T>): NullableNumberReturn<T, 'int8'>;
|
|
4592
4568
|
/**
|
|
4593
4569
|
* Selects the `percent_rank` window function.
|
|
4594
4570
|
*
|
|
@@ -4607,7 +4583,7 @@ declare class AggregateMethods {
|
|
|
4607
4583
|
*
|
|
4608
4584
|
* @param over - OVER clause config
|
|
4609
4585
|
*/
|
|
4610
|
-
percentRank<T extends
|
|
4586
|
+
percentRank<T extends PickQuerySelectableResultRelationsWindows>(this: T, over?: Over<T>): NullableNumberReturn<T, 'float8'>;
|
|
4611
4587
|
/**
|
|
4612
4588
|
* Selects the `cume_dist` window function.
|
|
4613
4589
|
*
|
|
@@ -4626,7 +4602,7 @@ declare class AggregateMethods {
|
|
|
4626
4602
|
*
|
|
4627
4603
|
* @param over - OVER clause config
|
|
4628
4604
|
*/
|
|
4629
|
-
cumeDist<T extends
|
|
4605
|
+
cumeDist<T extends PickQuerySelectableResultRelationsWindows>(this: T, over?: Over<T>): NullableNumberReturn<T, 'float8'>;
|
|
4630
4606
|
}
|
|
4631
4607
|
|
|
4632
4608
|
type OrExpressionArg = QueryOrExpressionBooleanOrNullResult | undefined;
|
|
@@ -4642,30 +4618,25 @@ declare class OrExpression extends Expression<BooleanQueryColumn> {
|
|
|
4642
4618
|
makeSQL(ctx: ToSQLCtx, quotedAs?: string): string;
|
|
4643
4619
|
}
|
|
4644
4620
|
|
|
4645
|
-
|
|
4646
|
-
|
|
4621
|
+
interface FromQuerySelf extends PickQuerySelectable, PickQueryShape, PickQueryReturnType, PickQueryWithData, PickQueryAs, PickQueryHasSelect {
|
|
4622
|
+
}
|
|
4623
|
+
type FromArg<T extends FromQuerySelf> = IsQuery | Exclude<keyof T['withData'], symbol | number>;
|
|
4647
4624
|
type FromResult<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>> = Arg extends string ? T['withData'] extends WithDataItems ? {
|
|
4648
|
-
[K in keyof T]: K extends '
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
} : SetQueryTableAlias<T, Arg> : Arg extends PickQueryTableMetaResultInputType ? {
|
|
4652
|
-
[K in keyof T]: K extends 'meta' ? {
|
|
4653
|
-
[K in keyof T['meta']]: K extends 'as' ? AliasOrTable<Arg> : K extends 'selectable' ? SelectableFromShape<Arg['result'], AliasOrTable<Arg>> : K extends 'kind' ? 'select' : K extends 'defaultSelect' ? keyof Arg['result'] : T['meta'][K];
|
|
4654
|
-
} : K extends 'result' ? Arg['result'] : K extends 'shape' ? Arg['result'] : K extends 'inputType' ? Arg['inputType'] : K extends 'then' ? QueryThenByQuery<T, Arg['result']> : T[K];
|
|
4625
|
+
[K in keyof T]: K extends '__selectable' ? SelectableFromShape<T['withData'][Arg]['shape'], Arg> : K extends 'result' ? T['withData'][Arg]['shape'] : K extends 'then' ? QueryThenByQuery<T, T['withData'][Arg]['shape']> : T[K];
|
|
4626
|
+
} : SetQueryTableAlias<T, Arg> : Arg extends PickQuerySelectableResultInputTypeAs ? {
|
|
4627
|
+
[K in keyof T]: K extends '__defaultSelect' ? keyof Arg['result'] : K extends '__selectable' ? SelectableFromShape<Arg['result'], Arg['__as']> : K extends '__as' ? Arg['__as'] : K extends 'result' ? Arg['result'] : K extends 'shape' ? Arg['result'] : K extends 'inputType' ? Arg['inputType'] : K extends 'then' ? QueryThenByQuery<T, Arg['result']> : T[K];
|
|
4655
4628
|
} : Arg extends (infer A)[] ? {
|
|
4656
|
-
[K in keyof T]: K extends '
|
|
4657
|
-
[K in keyof T['
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
} : never> : T['meta'][K];
|
|
4668
|
-
} : T[K];
|
|
4629
|
+
[K in keyof T]: K extends '__selectable' ? UnionToIntersection<A extends string ? T['withData'] extends WithDataItems ? {
|
|
4630
|
+
[K in keyof T['withData'][A]['shape'] & string as `${A}.${K}`]: {
|
|
4631
|
+
as: K;
|
|
4632
|
+
column: T['withData'][A]['shape'][K];
|
|
4633
|
+
};
|
|
4634
|
+
} : never : A extends PickQueryResultAs ? {
|
|
4635
|
+
[K in keyof A['result'] & string as `${A['__as']}.${K}`]: K extends string ? {
|
|
4636
|
+
as: K;
|
|
4637
|
+
column: A['result'][K];
|
|
4638
|
+
} : never;
|
|
4639
|
+
} : never> : T[K];
|
|
4669
4640
|
} : T;
|
|
4670
4641
|
declare function queryFrom<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>>(self: T, arg: Arg): FromResult<T, Arg>;
|
|
4671
4642
|
declare function queryFromSql<T extends FromQuerySelf>(self: T, args: SQLQueryArgs): T;
|
|
@@ -4701,7 +4672,7 @@ declare class FromMethods {
|
|
|
4701
4672
|
*
|
|
4702
4673
|
* @param arg - query or name of CTE table
|
|
4703
4674
|
*/
|
|
4704
|
-
from<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>>(this: T, arg: T['
|
|
4675
|
+
from<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>>(this: T, arg: T['__hasSelect'] extends true ? '`select` must be placed after `from`' : Arg): FromResult<T, Arg>;
|
|
4705
4676
|
/**
|
|
4706
4677
|
* Set the `FROM` value with custom SQL:
|
|
4707
4678
|
*
|
|
@@ -5214,14 +5185,14 @@ declare abstract class QueryHooks {
|
|
|
5214
5185
|
catchAfterCommitError<T>(this: T, fn: AfterCommitErrorHandler): T;
|
|
5215
5186
|
}
|
|
5216
5187
|
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
|
|
5220
|
-
|
|
5188
|
+
interface MergeQueryArg extends PickQueryTable, PickQuerySelectable, PickQueryResult, PickQueryReturnType, PickQueryWithData, PickQueryWindows, PickQueryThen, PickQueryHasSelect, PickQueryHasWhere {
|
|
5189
|
+
}
|
|
5190
|
+
type MergeQuery<T extends MergeQueryArg, Q extends MergeQueryArg> = {
|
|
5191
|
+
[K in keyof T]: K extends '__hasWhere' | '__hasSelect' ? T[K] & Q[K] : K extends '__selectable' | 'windows' | 'withData' ? Q[K] & Omit<T[K], keyof Q[K]> : K extends 'result' ? MergeQueryResult<T, Q> : K extends 'returnType' ? Q['returnType'] extends undefined ? T['returnType'] : Q['returnType'] : K extends 'then' ? Q['returnType'] extends undefined ? QueryThenByQuery<T, MergeQueryResult<T, Q>> : Q['returnType'] extends 'all' | 'one' | 'oneOrThrow' | 'rows' ? QueryThenByQuery<Q, MergeQueryResult<T, Q>> : Q['__hasSelect'] extends true ? Q['then'] : T['__hasSelect'] extends true ? T['then'] : Q['then'] : T[K];
|
|
5221
5192
|
};
|
|
5222
|
-
type MergeQueryResult<T extends
|
|
5193
|
+
type MergeQueryResult<T extends PickQueryHasSelectResult, Q extends PickQueryHasSelectResult> = T['__hasSelect'] extends true ? Q['__hasSelect'] extends true ? Omit<T['result'], keyof Q['result']> & Q['result'] : T['result'] : Q['result'];
|
|
5223
5194
|
declare class MergeQueryMethods {
|
|
5224
|
-
merge<T extends
|
|
5195
|
+
merge<T extends MergeQueryArg, Q extends MergeQueryArg>(this: T, q: Q): MergeQuery<T, Q>;
|
|
5225
5196
|
}
|
|
5226
5197
|
|
|
5227
5198
|
type CreateFromMethodNames = 'createOneFrom' | 'insertOneFrom' | CreateManyFromMethodNames;
|
|
@@ -5232,12 +5203,12 @@ interface QueryReturningOne extends IsQuery {
|
|
|
5232
5203
|
}
|
|
5233
5204
|
type CreateRawOrFromResult<T extends CreateSelf> = T extends {
|
|
5234
5205
|
isCount: true;
|
|
5235
|
-
} ?
|
|
5236
|
-
type InsertRawOrFromResult<T extends CreateSelf> = T['
|
|
5206
|
+
} ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsOne<T> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumn<T> : T;
|
|
5207
|
+
type InsertRawOrFromResult<T extends CreateSelf> = T['__hasSelect'] extends true ? T['returnType'] extends undefined | 'all' ? SetQueryReturnsOne<T> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumn<T> : T : SetQueryReturnsRowCount<T>;
|
|
5237
5208
|
type CreateManyFromResult<T extends CreateSelf> = T extends {
|
|
5238
5209
|
isCount: true;
|
|
5239
|
-
} ?
|
|
5240
|
-
type InsertManyFromResult<T extends CreateSelf> = T['
|
|
5210
|
+
} ? T : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T;
|
|
5211
|
+
type InsertManyFromResult<T extends CreateSelf> = T['__hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAll<T> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsPluckColumn<T> : T : SetQueryReturnsRowCountMany<T>;
|
|
5241
5212
|
/**
|
|
5242
5213
|
* Function to collect column names from the inner query of create `from` methods.
|
|
5243
5214
|
*
|
|
@@ -5413,10 +5384,9 @@ declare class QueryCreateFrom {
|
|
|
5413
5384
|
insertForEachFrom<T extends CreateSelf>(this: T, query: IsQuery): InsertManyFromResult<T>;
|
|
5414
5385
|
}
|
|
5415
5386
|
|
|
5416
|
-
interface CreateSelf extends IsQuery,
|
|
5417
|
-
inputType: RecordUnknown;
|
|
5387
|
+
interface CreateSelf extends IsQuery, PickQueryHasSelect, PickQueryDefaults, PickQueryResult, PickQueryRelations, PickQueryWithData, PickQueryReturnType, PickQueryShape, PickQueryUniqueProperties, PickQueryInputType {
|
|
5418
5388
|
}
|
|
5419
|
-
type CreateData<T extends CreateSelf> = EmptyObject extends T['relations'] ? CreateDataWithDefaults<T, keyof T['
|
|
5389
|
+
type CreateData<T extends CreateSelf> = EmptyObject extends T['relations'] ? CreateDataWithDefaults<T, keyof T['__defaults']> : CreateRelationsData<T>;
|
|
5420
5390
|
type CreateDataWithDefaults<T extends CreateSelf, Defaults extends PropertyKey> = {
|
|
5421
5391
|
[K in keyof T['inputType'] as K extends Defaults ? never : K]: K extends Defaults ? never : CreateColumn<T, K>;
|
|
5422
5392
|
} & {
|
|
@@ -5428,25 +5398,25 @@ type CreateDataWithDefaultsForRelations<T extends CreateSelf, Defaults extends k
|
|
|
5428
5398
|
[K in Defaults as K extends OmitFKeys ? never : K]?: CreateColumn<T, K>;
|
|
5429
5399
|
};
|
|
5430
5400
|
type CreateColumn<T extends CreateSelf, K extends keyof T['inputType']> = T['inputType'][K] | ((q: T) => QueryOrExpression<T['inputType'][K]>);
|
|
5431
|
-
type CreateRelationsData<T extends CreateSelf> = CreateDataWithDefaultsForRelations<T, keyof T['
|
|
5401
|
+
type CreateRelationsData<T extends CreateSelf> = CreateDataWithDefaultsForRelations<T, keyof T['__defaults'], T['relations'][keyof T['relations']]['omitForeignKeyInCreate']> & CreateBelongsToData<T> & T['relations'][keyof T['relations']]['optionalDataForCreate'];
|
|
5432
5402
|
type CreateBelongsToData<T extends CreateSelf> = [
|
|
5433
5403
|
T['relations'][keyof T['relations']]['dataForCreate']
|
|
5434
5404
|
] extends [never] ? EmptyObject : CreateRelationsDataOmittingFKeys<T, T['relations'][keyof T['relations']]['dataForCreate']>;
|
|
5435
|
-
type CreateRelationsDataOmittingFKeys<T extends CreateSelf, Union> = (Union extends RelationConfigDataForCreate ? (u: Union['columns'] extends keyof T['
|
|
5436
|
-
[P in Exclude<Union['columns'] & keyof T['inputType'], keyof T['
|
|
5405
|
+
type CreateRelationsDataOmittingFKeys<T extends CreateSelf, Union> = (Union extends RelationConfigDataForCreate ? (u: Union['columns'] extends keyof T['__defaults'] ? {
|
|
5406
|
+
[P in Exclude<Union['columns'] & keyof T['inputType'], keyof T['__defaults']>]: CreateColumn<T, P>;
|
|
5437
5407
|
} & {
|
|
5438
|
-
[P in keyof T['
|
|
5408
|
+
[P in keyof T['__defaults'] & Union['columns']]?: CreateColumn<T, P>;
|
|
5439
5409
|
} & Partial<Union['nested']> : {
|
|
5440
5410
|
[P in Union['columns'] & keyof T['inputType']]: CreateColumn<T, P>;
|
|
5441
5411
|
} | Union['nested']) => void : never) extends (u: infer Obj) => void ? Obj : never;
|
|
5442
5412
|
type CreateResult<T extends CreateSelf> = T extends {
|
|
5443
5413
|
isCount: true;
|
|
5444
|
-
} ?
|
|
5445
|
-
type InsertResult<T extends CreateSelf> = T['
|
|
5414
|
+
} ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneResult<T, NarrowCreateResult<T>> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnResult<T, NarrowCreateResult<T>> : SetQueryResult<T, NarrowCreateResult<T>>;
|
|
5415
|
+
type InsertResult<T extends CreateSelf> = T['__hasSelect'] extends true ? T['returnType'] extends undefined | 'all' ? SetQueryReturnsOneResult<T, NarrowCreateResult<T>> : T['returnType'] extends 'pluck' ? SetQueryReturnsColumnResult<T, NarrowCreateResult<T>> : SetQueryResult<T, NarrowCreateResult<T>> : SetQueryReturnsRowCount<T>;
|
|
5446
5416
|
type CreateManyResult<T extends CreateSelf> = T extends {
|
|
5447
5417
|
isCount: true;
|
|
5448
|
-
} ?
|
|
5449
|
-
type InsertManyResult<T extends CreateSelf> = T['
|
|
5418
|
+
} ? SetQueryResult<T, NarrowCreateResult<T>> : T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllResult<T, NarrowCreateResult<T>> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnResult<T, NarrowCreateResult<T>> : SetQueryResult<T, NarrowCreateResult<T>>;
|
|
5419
|
+
type InsertManyResult<T extends CreateSelf> = T['__hasSelect'] extends true ? T['returnType'] extends 'one' | 'oneOrThrow' ? SetQueryReturnsAllResult<T, NarrowCreateResult<T>> : T['returnType'] extends 'value' | 'valueOrThrow' ? SetQueryReturnsPluckColumnResult<T, NarrowCreateResult<T>> : SetQueryResult<T, NarrowCreateResult<T>> : SetQueryReturnsRowCountMany<T>;
|
|
5450
5420
|
/**
|
|
5451
5421
|
* When creating a record with a *belongs to* nested record,
|
|
5452
5422
|
* un-nullify foreign key columns of the result.
|
|
@@ -5460,9 +5430,9 @@ type IgnoreResult<T extends CreateSelf> = T['returnType'] extends 'oneOrThrow' ?
|
|
|
5460
5430
|
type OnConflictArg<T extends PickQueryUniqueProperties> = T['internal']['uniqueColumnNames'] | T['internal']['uniqueColumnTuples'] | Expression | {
|
|
5461
5431
|
constraint: T['internal']['uniqueConstraints'];
|
|
5462
5432
|
};
|
|
5463
|
-
type AddQueryDefaults<T extends CreateSelf,
|
|
5464
|
-
[K in keyof T]: K extends '
|
|
5465
|
-
[K in keyof T['
|
|
5433
|
+
type AddQueryDefaults<T extends CreateSelf, DefaultKeys extends PropertyKey> = {
|
|
5434
|
+
[K in keyof T]: K extends '__defaults' ? {
|
|
5435
|
+
[K in keyof T['__defaults'] | DefaultKeys]: true;
|
|
5466
5436
|
} : T[K];
|
|
5467
5437
|
};
|
|
5468
5438
|
/**
|
|
@@ -5526,7 +5496,7 @@ declare const _queryCreate: <T extends CreateSelf>(q: T, data: CreateData<T>) =>
|
|
|
5526
5496
|
declare const _queryInsert: <T extends CreateSelf>(query: T, data: CreateData<T>) => InsertResult<T>;
|
|
5527
5497
|
declare const _queryCreateMany: <T extends CreateSelf>(q: T, data: CreateData<T>[]) => CreateManyResult<T>;
|
|
5528
5498
|
declare const _queryInsertMany: <T extends CreateSelf>(q: T, data: CreateData<T>[]) => InsertManyResult<T>;
|
|
5529
|
-
declare const _queryDefaults: <T extends CreateSelf, Data extends Partial<CreateData<T>>>(q: T, data: Data) => AddQueryDefaults<T,
|
|
5499
|
+
declare const _queryDefaults: <T extends CreateSelf, Data extends Partial<CreateData<T>>>(q: T, data: Data) => AddQueryDefaults<T, keyof Data>;
|
|
5530
5500
|
/**
|
|
5531
5501
|
* Names of all create methods,
|
|
5532
5502
|
* is used in relational query to remove these methods if chained relation shouldn't have them,
|
|
@@ -5661,9 +5631,7 @@ declare class QueryCreate {
|
|
|
5661
5631
|
*
|
|
5662
5632
|
* @param data - default values for `create` and `createMany` which will follow `defaults`
|
|
5663
5633
|
*/
|
|
5664
|
-
defaults<T extends CreateSelf, Data extends Partial<CreateData<T>>>(this: T, data: Data): AddQueryDefaults<T,
|
|
5665
|
-
[K in keyof Data]: true;
|
|
5666
|
-
}>;
|
|
5634
|
+
defaults<T extends CreateSelf, Data extends Partial<CreateData<T>>>(this: T, data: Data): AddQueryDefaults<T, keyof Data>;
|
|
5667
5635
|
/**
|
|
5668
5636
|
* By default, violating unique constraint will cause the creative query to throw,
|
|
5669
5637
|
* you can define what to do on a conflict: to ignore it, or to merge the existing record with a new data.
|
|
@@ -5891,8 +5859,7 @@ type OnConflictMerge = string | string[] | {
|
|
|
5891
5859
|
declare const makeInsertSql: (ctx: ToSQLCtx, q: ToSQLQuery, query: QueryData, quotedAs: string, isSubSql?: boolean) => Sql;
|
|
5892
5860
|
declare const makeReturningSql: (ctx: ToSQLCtx, q: ToSQLQuery, data: QueryData, quotedAs: string, delayedRelationSelect: DelayedRelationSelect | undefined, hookPurpose?: HookPurpose, addHookPurpose?: HookPurpose, isSubSql?: boolean) => string | undefined;
|
|
5893
5861
|
|
|
5894
|
-
interface UpdateSelf extends
|
|
5895
|
-
inputType: RecordUnknown;
|
|
5862
|
+
interface UpdateSelf extends PickQuerySelectable, PickQueryResult, PickQueryRelations, PickQueryWithData, PickQueryReturnType, PickQueryShape, PickQueryInputType, PickQueryShape, PickQueryAs, PickQueryHasSelect, PickQueryHasWhere {
|
|
5896
5863
|
}
|
|
5897
5864
|
type UpdateData<T extends UpdateSelf> = EmptyObject extends T['relations'] ? {
|
|
5898
5865
|
[K in keyof T['inputType']]?: UpdateColumn<T, K>;
|
|
@@ -5903,8 +5870,8 @@ type UpdateColumn<T extends UpdateSelf, Key extends keyof T['inputType']> = T['i
|
|
|
5903
5870
|
[K in keyof T['relations'] | keyof T]: K extends keyof T['relations'] ? T['relations'][K]['query'] : K extends keyof T ? T[K] : never;
|
|
5904
5871
|
}) => QueryOrExpression<T['inputType'][Key]>);
|
|
5905
5872
|
type UpdateRelationData<T extends UpdateSelf, Rel extends RelationConfigBase> = T['returnType'] extends undefined | 'all' ? Rel['dataForUpdate'] : Rel['dataForUpdateOne'];
|
|
5906
|
-
type UpdateArg<T extends UpdateSelf> = T['
|
|
5907
|
-
type UpdateResult<T extends UpdateSelf> = T['
|
|
5873
|
+
type UpdateArg<T extends UpdateSelf> = T['__hasWhere'] extends true ? UpdateData<T> : 'Update statement must have where conditions. To update all prefix `update` with `all()`';
|
|
5874
|
+
type UpdateResult<T extends UpdateSelf> = T['__hasSelect'] extends true ? T : T['returnType'] extends undefined | 'all' ? SetQueryReturnsRowCountMany<T> : SetQueryReturnsRowCount<T>;
|
|
5908
5875
|
type NumericColumns<T extends UpdateSelf> = {
|
|
5909
5876
|
[K in keyof T['inputType']]: Exclude<T['shape'][K]['queryType'], string> extends number | bigint | null ? K : never;
|
|
5910
5877
|
}[keyof T['inputType']];
|
|
@@ -6196,7 +6163,7 @@ declare class Update {
|
|
|
6196
6163
|
* .set({ authorName: (q) => q.ref('author.name') });
|
|
6197
6164
|
* ```
|
|
6198
6165
|
*/
|
|
6199
|
-
updateFrom<T extends
|
|
6166
|
+
updateFrom<T extends UpdateSelf, Arg extends JoinFirstArg<T>, Args extends JoinArgs<T, Arg>>(this: T, arg: Arg, ...args: Args): JoinResultFromArgs<T, Arg, Args, true, true> & QueryHasWhere;
|
|
6200
6167
|
/**
|
|
6201
6168
|
* Use after {@link updateFrom}
|
|
6202
6169
|
*/
|
|
@@ -6286,14 +6253,11 @@ type UpsertCreate<DataKey extends PropertyKey, CD> = {
|
|
|
6286
6253
|
} & {
|
|
6287
6254
|
[K in DataKey]?: K extends keyof CD ? CD[K] : never;
|
|
6288
6255
|
};
|
|
6289
|
-
type UpsertResult<T extends
|
|
6256
|
+
type UpsertResult<T extends PickQueryHasSelectResultReturnType> = T['__hasSelect'] extends true ? T['returnType'] extends 'value' | 'valueOrThrow' ? SetValueQueryReturnsValueOrThrow<T> : SetQueryReturnsOne<T> : SetQueryReturnsVoid<T>;
|
|
6290
6257
|
interface UpsertThis extends UpdateSelf, CreateSelf {
|
|
6291
|
-
|
|
6258
|
+
__hasWhere: true;
|
|
6292
6259
|
returnType: 'one' | 'oneOrThrow' | 'value' | 'valueOrThrow' | 'void';
|
|
6293
6260
|
}
|
|
6294
|
-
interface MetaPropHasWhere extends QueryMetaBase {
|
|
6295
|
-
hasWhere: true;
|
|
6296
|
-
}
|
|
6297
6261
|
interface QueryUpsert {
|
|
6298
6262
|
/**
|
|
6299
6263
|
* `upsert` tries to update a single record, and then it creates the record if it doesn't yet exist.
|
|
@@ -6413,7 +6377,7 @@ interface QueryUpsert {
|
|
|
6413
6377
|
declare const QueryUpsert: QueryUpsert;
|
|
6414
6378
|
|
|
6415
6379
|
type OrCreateArg<Data> = Data | (() => Data);
|
|
6416
|
-
declare function _orCreate<T extends
|
|
6380
|
+
declare function _orCreate<T extends PickQueryHasSelectResultReturnType>(query: T, data: unknown | FnUnknownToUnknown, updateData?: unknown, mergeData?: unknown): UpsertResult<T>;
|
|
6417
6381
|
interface QueryOrCreate {
|
|
6418
6382
|
/**
|
|
6419
6383
|
* `orCreate` creates a record only if it was not found by conditions.
|
|
@@ -6485,17 +6449,8 @@ interface QueryOrCreate {
|
|
|
6485
6449
|
}
|
|
6486
6450
|
declare const QueryOrCreate: QueryOrCreate;
|
|
6487
6451
|
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
}
|
|
6491
|
-
/**
|
|
6492
|
-
* In snake case mode, or when columns have custom names,
|
|
6493
|
-
* use this method to exchange a db column name to its runtime key.
|
|
6494
|
-
*/
|
|
6495
|
-
declare const queryColumnNameToKey: (q: QueryBase, name: string) => string | undefined;
|
|
6496
|
-
|
|
6497
|
-
declare const getPrimaryKeys: (q: QueryBase) => string[];
|
|
6498
|
-
declare const requirePrimaryKeys: (q: QueryBase, message: string) => string[];
|
|
6452
|
+
declare const getPrimaryKeys: (q: Query) => string[];
|
|
6453
|
+
declare const requirePrimaryKeys: (q: Query, message: string) => string[];
|
|
6499
6454
|
|
|
6500
6455
|
declare const checkIfASimpleQuery: (q: PickQueryQ) => boolean;
|
|
6501
6456
|
|
|
@@ -6586,7 +6541,7 @@ interface WindowDeclaration {
|
|
|
6586
6541
|
declare const windowToSql: (ctx: ToSQLCtx, data: QueryData, window: string | WindowDeclaration | Expression, quotedAs?: string) => string;
|
|
6587
6542
|
|
|
6588
6543
|
type WrapQueryArg = FromQuerySelf;
|
|
6589
|
-
declare function queryWrap<T extends
|
|
6544
|
+
declare function queryWrap<T extends IsQuery, Q extends WrapQueryArg, As extends string = 't'>(self: T, query: Q, as?: As): SetQueryTableAlias<Q, As>;
|
|
6590
6545
|
/**
|
|
6591
6546
|
* This function is useful when wrapping a query,
|
|
6592
6547
|
* such as when doing `SELECT json_agg(t.*) FROM (...) AS t`,
|
|
@@ -6595,7 +6550,7 @@ declare function queryWrap<T extends PickQueryTableMetaResult, Q extends WrapQue
|
|
|
6595
6550
|
*/
|
|
6596
6551
|
declare function cloneQueryBaseUnscoped(query: Query): Query;
|
|
6597
6552
|
declare class QueryWrap {
|
|
6598
|
-
wrap<T extends
|
|
6553
|
+
wrap<T extends IsQuery, Q extends WrapQueryArg, As extends string = 't'>(this: T, query: Q, as?: As): SetQueryTableAlias<Q, As>;
|
|
6599
6554
|
}
|
|
6600
6555
|
|
|
6601
6556
|
/**
|
|
@@ -6642,24 +6597,6 @@ declare const _queryExec: <T extends IsQuery>(q: T) => never;
|
|
|
6642
6597
|
declare const _queryRows: <T extends PickQueryResult>(q: T) => SetQueryReturnsRows<T>;
|
|
6643
6598
|
declare const getFullColumnTable: (q: IsQuery, column: string, index: number, as: string | getValueKey | undefined) => string;
|
|
6644
6599
|
|
|
6645
|
-
interface QueryInternalTableDataPrimaryKey {
|
|
6646
|
-
columns: string[];
|
|
6647
|
-
name?: string;
|
|
6648
|
-
}
|
|
6649
|
-
interface QueryInternalTableDataBase {
|
|
6650
|
-
primaryKey?: QueryInternalTableDataPrimaryKey;
|
|
6651
|
-
}
|
|
6652
|
-
interface QueryInternalBase extends QueryInternalColumnNameToKey {
|
|
6653
|
-
runtimeDefaultColumns?: string[];
|
|
6654
|
-
transactionStorage: AsyncLocalStorage<TransactionState>;
|
|
6655
|
-
scopes?: RecordUnknown;
|
|
6656
|
-
snakeCase?: boolean;
|
|
6657
|
-
noPrimaryKey: boolean;
|
|
6658
|
-
comment?: string;
|
|
6659
|
-
primaryKeys?: string[];
|
|
6660
|
-
tableData: QueryInternalTableDataBase;
|
|
6661
|
-
}
|
|
6662
|
-
|
|
6663
6600
|
interface TableData {
|
|
6664
6601
|
primaryKey?: TableData.PrimaryKey;
|
|
6665
6602
|
indexes?: TableData.Index[];
|
|
@@ -7486,12 +7423,17 @@ interface OperatorToSQL {
|
|
|
7486
7423
|
(key: string, args: [unknown], ctx: unknown, quotedAs?: string): string;
|
|
7487
7424
|
}
|
|
7488
7425
|
interface Operator<Value, Column extends Column.Pick.OutputTypeAndOperators = Column.Pick.OutputTypeAndOperators> {
|
|
7489
|
-
<T extends PickQueryResult>(this: T, arg: Value):
|
|
7426
|
+
<T extends PickQueryResult>(this: T, arg: Value): {
|
|
7427
|
+
[K in Exclude<keyof T, keyof T['result']['value']['operators']>]: K extends 'result' ? {
|
|
7428
|
+
value: Column;
|
|
7429
|
+
} : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['outputType']> : T[K];
|
|
7430
|
+
} & Column['operators'];
|
|
7490
7431
|
_opType: Value;
|
|
7491
7432
|
}
|
|
7492
7433
|
declare function setQueryOperators(query: IsQuery, operators: RecordUnknown): IsQuery;
|
|
7493
7434
|
declare const prepareOpArg: (q: unknown, arg: unknown) => SubQueryForSql | undefined;
|
|
7494
7435
|
interface Base<Value> {
|
|
7436
|
+
__hasSelect: true;
|
|
7495
7437
|
equals: Operator<Value | IsQuery | Expression, BooleanQueryColumn>;
|
|
7496
7438
|
not: Operator<Value | IsQuery | Expression, BooleanQueryColumn>;
|
|
7497
7439
|
in: Operator<Value[] | IsQuery | Expression, BooleanQueryColumn>;
|
|
@@ -7710,7 +7652,7 @@ interface OperatorsArray<T> extends Ord<T[]> {
|
|
|
7710
7652
|
containedIn: Operator<T[] | IsQuery | Expression, BooleanQueryColumn>;
|
|
7711
7653
|
length: {
|
|
7712
7654
|
_opType: number | {
|
|
7713
|
-
[K in keyof OperatorsNumber]?: OperatorsNumber[K]['_opType'];
|
|
7655
|
+
[K in Exclude<keyof OperatorsNumber, '__hasSelect'>]?: OperatorsNumber[K]['_opType'];
|
|
7714
7656
|
};
|
|
7715
7657
|
};
|
|
7716
7658
|
}
|
|
@@ -7726,17 +7668,9 @@ declare const Operators: {
|
|
|
7726
7668
|
array: OperatorsArray<unknown>;
|
|
7727
7669
|
};
|
|
7728
7670
|
|
|
7729
|
-
type SelectableOrExpression<T extends
|
|
7730
|
-
type SelectableOrExpressions<T extends
|
|
7731
|
-
|
|
7732
|
-
selectable: unknown;
|
|
7733
|
-
};
|
|
7734
|
-
} = {
|
|
7735
|
-
meta: {
|
|
7736
|
-
selectable: unknown;
|
|
7737
|
-
};
|
|
7738
|
-
}, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumn> = ('*' | keyof T['meta']['selectable'] | Expression<C>)[];
|
|
7739
|
-
type ExpressionOutput<T extends PickQueryMeta, Expr extends SelectableOrExpression<T>> = Expr extends keyof T['meta']['selectable'] ? T['meta']['selectable'][Expr]['column'] : Expr extends Expression ? Expr['result']['value'] : never;
|
|
7671
|
+
type SelectableOrExpression<T extends PickQuerySelectable = PickQuerySelectable, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumn> = '*' | keyof T['__selectable'] | Expression<C>;
|
|
7672
|
+
type SelectableOrExpressions<T extends PickQuerySelectable = PickQuerySelectable, C extends Column.Pick.QueryColumn = Column.Pick.QueryColumn> = ('*' | keyof T['__selectable'] | Expression<C>)[];
|
|
7673
|
+
type ExpressionOutput<T extends PickQuerySelectable, Expr extends SelectableOrExpression<T>> = Expr extends keyof T['__selectable'] ? T['__selectable'][Expr]['column'] : Expr extends Expression ? Expr['result']['value'] : never;
|
|
7740
7674
|
type ExpressionChain = (OperatorToSQL | unknown)[];
|
|
7741
7675
|
interface ExpressionData extends HasBeforeAndBeforeSet {
|
|
7742
7676
|
chain?: ExpressionChain;
|
|
@@ -8004,7 +7938,7 @@ declare namespace Column {
|
|
|
8004
7938
|
explicitSelect?: boolean;
|
|
8005
7939
|
as?: Column.Pick.Data;
|
|
8006
7940
|
unique?: string;
|
|
8007
|
-
modifyQuery?(q:
|
|
7941
|
+
modifyQuery?(q: Query, column: Column.Pick.Data): void;
|
|
8008
7942
|
checks?: Column.Data.Check[];
|
|
8009
7943
|
isOfCustomType?: boolean;
|
|
8010
7944
|
errors?: RecordString;
|
|
@@ -8978,12 +8912,10 @@ interface QueryComputedArg<ColumnTypes, Shape extends Column.QueryColumns> exten
|
|
|
8978
8912
|
windows: EmptyObject;
|
|
8979
8913
|
relations: RelationsBase;
|
|
8980
8914
|
result: EmptyObject;
|
|
8981
|
-
|
|
8982
|
-
|
|
8983
|
-
|
|
8984
|
-
|
|
8985
|
-
column: Column.Pick.QueryColumn;
|
|
8986
|
-
};
|
|
8915
|
+
__selectable: {
|
|
8916
|
+
[K in keyof Shape]: {
|
|
8917
|
+
as: string;
|
|
8918
|
+
column: Column.Pick.QueryColumn;
|
|
8987
8919
|
};
|
|
8988
8920
|
};
|
|
8989
8921
|
}
|
|
@@ -9045,15 +8977,11 @@ interface HandleResult {
|
|
|
9045
8977
|
(q: Query, returnType: QueryReturnType, result: QueryResult, sql: Sql, isSubQuery?: true): unknown;
|
|
9046
8978
|
}
|
|
9047
8979
|
type WithItems = CteItem[];
|
|
9048
|
-
interface QueryDataBase extends QueryDataAliases, PickQueryDataParsers, HasHookSelect {
|
|
9049
|
-
shape: Column.QueryColumnsInit;
|
|
9050
|
-
select?: unknown;
|
|
9051
|
-
}
|
|
9052
8980
|
interface JoinValueDedupItem {
|
|
9053
8981
|
q: Query;
|
|
9054
8982
|
a: string;
|
|
9055
8983
|
}
|
|
9056
|
-
interface QueryData extends
|
|
8984
|
+
interface QueryData extends QueryDataAliases, PickQueryDataParsers, HasHookSelect {
|
|
9057
8985
|
type: undefined | null | 'upsert' | 'insert' | 'update' | 'delete' | 'truncate' | 'columnInfo' | 'copy';
|
|
9058
8986
|
adapter: AdapterBase;
|
|
9059
8987
|
shape: ColumnsShape;
|
|
@@ -9257,7 +9185,6 @@ interface ToSQLQuery {
|
|
|
9257
9185
|
withData: Query['withData'];
|
|
9258
9186
|
clone: Query['clone'];
|
|
9259
9187
|
baseQuery: Query['baseQuery'];
|
|
9260
|
-
meta: Query['meta'];
|
|
9261
9188
|
returnType: Query['returnType'];
|
|
9262
9189
|
result: Query['result'];
|
|
9263
9190
|
shape: Query['shape'];
|
|
@@ -9387,8 +9314,8 @@ declare class For {
|
|
|
9387
9314
|
forKeyShare<T extends IsQuery>(this: T, tableNames?: string[] | Expression): ForQueryBuilder<T>;
|
|
9388
9315
|
}
|
|
9389
9316
|
|
|
9390
|
-
type HeadlineSearchArg<T extends
|
|
9391
|
-
interface HeadlineParams<T extends
|
|
9317
|
+
type HeadlineSearchArg<T extends PickQueryTsQuery> = Exclude<T['__tsQuery'], undefined>;
|
|
9318
|
+
interface HeadlineParams<T extends PickQuerySelectable> {
|
|
9392
9319
|
text?: SelectableOrExpressionOfType<T, Column.Pick.QueryColumnOfType<string>>;
|
|
9393
9320
|
options?: string | Expression;
|
|
9394
9321
|
}
|
|
@@ -9464,26 +9391,26 @@ declare module '../../basic-features/aggregate/aggregate' {
|
|
|
9464
9391
|
* @param search - name of the search to use the query from
|
|
9465
9392
|
* @param options - `text` for a text source, `options` for `ts_headline` options
|
|
9466
9393
|
*/
|
|
9467
|
-
headline<T extends
|
|
9394
|
+
headline<T extends OrderArgSelf>(this: T, search: HeadlineSearchArg<T>, options?: HeadlineParams<T>): SetQueryReturnsColumnOrThrow<T, Column.Pick.QueryColumnOfType<string>>;
|
|
9468
9395
|
}
|
|
9469
9396
|
}
|
|
9470
|
-
type SearchArg<T extends
|
|
9397
|
+
type SearchArg<T extends PickQuerySelectable, As extends string> = {
|
|
9471
9398
|
as?: As;
|
|
9472
9399
|
order?: OrderTsQueryConfig;
|
|
9473
9400
|
} & ({
|
|
9474
9401
|
language?: string | Expression;
|
|
9475
9402
|
} | {
|
|
9476
|
-
languageColumn?: keyof T['
|
|
9403
|
+
languageColumn?: keyof T['__selectable'];
|
|
9477
9404
|
}) & ({
|
|
9478
9405
|
text: string | Expression;
|
|
9479
9406
|
} | {
|
|
9480
|
-
in: MaybeArray<keyof T['
|
|
9481
|
-
[K in keyof T['
|
|
9407
|
+
in: MaybeArray<keyof T['__selectable']> | {
|
|
9408
|
+
[K in keyof T['__selectable']]?: SearchWeight;
|
|
9482
9409
|
};
|
|
9483
9410
|
} | {
|
|
9484
9411
|
vector: {
|
|
9485
|
-
[K in keyof T['
|
|
9486
|
-
}[keyof T['
|
|
9412
|
+
[K in keyof T['__selectable']]: T['__selectable'][K]['column']['dataType'] extends 'tsvector' ? K : never;
|
|
9413
|
+
}[keyof T['__selectable']];
|
|
9487
9414
|
}) & ({
|
|
9488
9415
|
query: string | Expression;
|
|
9489
9416
|
} | {
|
|
@@ -9494,9 +9421,7 @@ type SearchArg<T extends PickQueryMeta, As extends string> = {
|
|
|
9494
9421
|
tsQuery: string | Expression;
|
|
9495
9422
|
});
|
|
9496
9423
|
type WhereSearchResult<T, As extends string> = T & {
|
|
9497
|
-
|
|
9498
|
-
tsQuery: string extends As ? never : As;
|
|
9499
|
-
};
|
|
9424
|
+
__tsQuery: string extends As ? never : As;
|
|
9500
9425
|
};
|
|
9501
9426
|
declare class SearchMethods {
|
|
9502
9427
|
/**
|
|
@@ -9687,7 +9612,7 @@ declare class SearchMethods {
|
|
|
9687
9612
|
*
|
|
9688
9613
|
* @param arg - search config
|
|
9689
9614
|
*/
|
|
9690
|
-
search<T extends
|
|
9615
|
+
search<T extends PickQuerySelectable, As extends string>(this: T, arg: SearchArg<T, As>): WhereSearchResult<T, As>;
|
|
9691
9616
|
}
|
|
9692
9617
|
|
|
9693
9618
|
type ClearStatement = 'with' | 'select' | 'where' | 'union' | 'using' | 'join' | 'group' | 'order' | 'having' | 'limit' | 'offset' | 'counters';
|
|
@@ -9857,10 +9782,10 @@ declare class QueryDistinct {
|
|
|
9857
9782
|
*
|
|
9858
9783
|
* @param columns - column names or a raw SQL
|
|
9859
9784
|
*/
|
|
9860
|
-
distinct<T extends
|
|
9785
|
+
distinct<T extends PickQuerySelectable>(this: T, ...columns: SelectableOrExpressions<T>): T;
|
|
9861
9786
|
}
|
|
9862
9787
|
|
|
9863
|
-
interface SubQueryReturningSingle extends
|
|
9788
|
+
interface SubQueryReturningSingle extends IsSubQuery {
|
|
9864
9789
|
returnType: 'one' | 'oneOrThrow';
|
|
9865
9790
|
}
|
|
9866
9791
|
declare class QueryLimitOffset {
|
|
@@ -9903,20 +9828,18 @@ declare class QueryTruncate {
|
|
|
9903
9828
|
*
|
|
9904
9829
|
* @param options - truncate options, may have `cascade: true` and `restartIdentity: true`
|
|
9905
9830
|
*/
|
|
9906
|
-
truncate<T
|
|
9831
|
+
truncate<T>(this: T, options?: {
|
|
9907
9832
|
restartIdentity?: boolean;
|
|
9908
9833
|
cascade?: boolean;
|
|
9909
|
-
}):
|
|
9834
|
+
}): SetQueryReturnsVoid<T>;
|
|
9910
9835
|
}
|
|
9911
9836
|
|
|
9912
9837
|
type GroupArgs<T extends PickQueryResult> = ({
|
|
9913
9838
|
[K in keyof T['result']]: T['result'][K]['dataType'] extends 'array' | 'object' | 'runtimeComputed' ? never : K;
|
|
9914
9839
|
}[keyof T['result']] | Expression)[];
|
|
9915
|
-
interface QueryHelperQuery<T extends
|
|
9840
|
+
interface QueryHelperQuery<T extends PickQuerySelectableShapeAs> extends MergeQueryArg {
|
|
9916
9841
|
returnType: QueryReturnType;
|
|
9917
|
-
|
|
9918
|
-
selectable: Omit<T['meta']['selectable'], `${AliasOrTable<T>}.${Extract<keyof T['shape'], string>}`>;
|
|
9919
|
-
};
|
|
9842
|
+
__selectable: Omit<T['__selectable'], `${T['__as']}.${Extract<keyof T['shape'], string>}`>;
|
|
9920
9843
|
result: Column.QueryColumns;
|
|
9921
9844
|
windows: EmptyObject;
|
|
9922
9845
|
withData: WithDataItems;
|
|
@@ -9931,35 +9854,36 @@ interface IsQueryHelper {
|
|
|
9931
9854
|
interface IsQueryHelperForTable<Table extends string | undefined> extends IsQueryHelper {
|
|
9932
9855
|
table: Table;
|
|
9933
9856
|
}
|
|
9934
|
-
interface QueryHelper<T extends
|
|
9935
|
-
<Q extends QueryHelperQuery<T>>(q: Q, ...args: Args): Result extends
|
|
9857
|
+
interface QueryHelper<T extends PickQueryTableMetaShapeTableAs, Args extends any[], Result> extends IsQueryHelper {
|
|
9858
|
+
<Q extends QueryHelperQuery<T>>(q: Q, ...args: Args): Result extends MergeQueryArg ? MergeQuery<Q, Result> : Result;
|
|
9859
|
+
__as: T['__as'];
|
|
9936
9860
|
table: T['table'];
|
|
9937
9861
|
args: Args;
|
|
9938
9862
|
result: Result;
|
|
9939
9863
|
}
|
|
9940
|
-
type QueryHelperResult<T extends QueryHelper<
|
|
9941
|
-
interface NarrowTypeSelf extends
|
|
9864
|
+
type QueryHelperResult<T extends QueryHelper<PickQueryTableMetaShapeTableAs, any[], MergeQueryArg>> = T['result'];
|
|
9865
|
+
interface NarrowTypeSelf extends PickQueryResultReturnType {
|
|
9942
9866
|
returnType: undefined | 'all' | 'one' | 'oneOrThrow' | 'value' | 'valueOrThrow' | 'pluck';
|
|
9943
9867
|
}
|
|
9944
9868
|
type NarrowInvalidKeys<T extends PickQueryResult, Narrow> = {
|
|
9945
9869
|
[K in keyof Narrow]: K extends keyof T['result'] ? Narrow[K] extends T['result'][K]['outputType'] ? never : K : K;
|
|
9946
9870
|
}[keyof Narrow];
|
|
9947
|
-
interface NarrowValueTypeResult<T extends
|
|
9871
|
+
interface NarrowValueTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column.QueryColumns {
|
|
9948
9872
|
value: {
|
|
9949
9873
|
[K in keyof T['result']['value']]: K extends 'outputType' ? Narrow : T['result']['value'][K];
|
|
9950
9874
|
};
|
|
9951
9875
|
}
|
|
9952
|
-
interface NarrowPluckTypeResult<T extends
|
|
9876
|
+
interface NarrowPluckTypeResult<T extends PickQueryResultReturnType, Narrow> extends Column.QueryColumns {
|
|
9953
9877
|
pluck: {
|
|
9954
9878
|
[K in keyof T['result']['pluck']]: K extends 'outputType' ? Narrow extends unknown[] ? Narrow[number] : Narrow : T['result']['pluck'][K];
|
|
9955
9879
|
};
|
|
9956
9880
|
}
|
|
9957
|
-
type QueryIfResult<T extends
|
|
9881
|
+
type QueryIfResult<T extends PickQueryResultReturnType, R extends PickQueryResult> = {
|
|
9958
9882
|
[K in keyof T]: K extends 'result' ? {
|
|
9959
9883
|
[K in keyof T['result'] | keyof R['result']]: K extends keyof T['result'] ? K extends keyof R['result'] ? R['result'][K] | T['result'][K] : T['result'][K] : R['result'][K];
|
|
9960
9884
|
} : K extends 'then' ? QueryIfResultThen<T, R> : T[K];
|
|
9961
9885
|
};
|
|
9962
|
-
type QueryIfResultThen<T extends
|
|
9886
|
+
type QueryIfResultThen<T extends PickQueryResultReturnType, R extends PickQueryResult> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<{
|
|
9963
9887
|
[K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['outputType'] | R['result'][K]['outputType'] : T['result'][K]['outputType'];
|
|
9964
9888
|
} & {
|
|
9965
9889
|
[K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['outputType'];
|
|
@@ -10037,7 +9961,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10037
9961
|
* ```
|
|
10038
9962
|
* @param select - column name or a raw SQL
|
|
10039
9963
|
*/
|
|
10040
|
-
pluck<T extends
|
|
9964
|
+
pluck<T extends PickQuerySelectable, S extends SelectableOrExpression<T>>(this: T, select: S): SetQueryReturnsPluck<T, S>;
|
|
10041
9965
|
/**
|
|
10042
9966
|
* `.exec` won't parse the response at all, and returns undefined:
|
|
10043
9967
|
*
|
|
@@ -10081,7 +10005,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10081
10005
|
*
|
|
10082
10006
|
* @param value - primary key value to find by
|
|
10083
10007
|
*/
|
|
10084
|
-
find<T extends PickQueryShapeResultReturnTypeSinglePrimaryKey>(this: T, value: T['internal']['singlePrimaryKey'] | Expression): QueryTake<T> &
|
|
10008
|
+
find<T extends PickQueryShapeResultReturnTypeSinglePrimaryKey>(this: T, value: T['internal']['singlePrimaryKey'] | Expression): QueryTake<T> & QueryHasWhere;
|
|
10085
10009
|
/**
|
|
10086
10010
|
* Finds a single record with a given SQL, throws {@link NotFoundError} if not found:
|
|
10087
10011
|
*
|
|
@@ -10094,7 +10018,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10094
10018
|
*
|
|
10095
10019
|
* @param args - SQL expression
|
|
10096
10020
|
*/
|
|
10097
|
-
findBySql<T extends PickQueryResultReturnType>(this: T, ...args: SQLQueryArgs): QueryTake<T> &
|
|
10021
|
+
findBySql<T extends PickQueryResultReturnType>(this: T, ...args: SQLQueryArgs): QueryTake<T> & QueryHasWhere;
|
|
10098
10022
|
/**
|
|
10099
10023
|
* Finds a single record by the primary key (id), returns `undefined` when not found.
|
|
10100
10024
|
* Not available if the table has no or multiple primary keys.
|
|
@@ -10105,7 +10029,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10105
10029
|
*
|
|
10106
10030
|
* @param value - primary key value to find by, or a raw SQL
|
|
10107
10031
|
*/
|
|
10108
|
-
findOptional<T extends PickQueryShapeResultReturnTypeSinglePrimaryKey>(this: T, value: T['internal']['singlePrimaryKey'] | Expression): QueryTakeOptional<T> &
|
|
10032
|
+
findOptional<T extends PickQueryShapeResultReturnTypeSinglePrimaryKey>(this: T, value: T['internal']['singlePrimaryKey'] | Expression): QueryTakeOptional<T> & QueryHasWhere;
|
|
10109
10033
|
/**
|
|
10110
10034
|
* Finds a single record with a given SQL.
|
|
10111
10035
|
* Returns `undefined` when not found.
|
|
@@ -10119,7 +10043,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10119
10043
|
*
|
|
10120
10044
|
* @param args - SQL expression
|
|
10121
10045
|
*/
|
|
10122
|
-
findBySqlOptional<T extends PickQueryResultReturnType>(this: T, ...args: SQLQueryArgs): QueryTakeOptional<T> &
|
|
10046
|
+
findBySqlOptional<T extends PickQueryResultReturnType>(this: T, ...args: SQLQueryArgs): QueryTakeOptional<T> & QueryHasWhere;
|
|
10123
10047
|
/**
|
|
10124
10048
|
* Finds a single unique record, throws [NotFoundError](/guide/error-handling.html) if not found.
|
|
10125
10049
|
* It accepts values of primary keys or unique indexes defined on the table.
|
|
@@ -10133,7 +10057,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10133
10057
|
*
|
|
10134
10058
|
* @param uniqueColumnValues - is derived from primary keys and unique indexes in the table
|
|
10135
10059
|
*/
|
|
10136
|
-
findBy<T extends PickQueryResultReturnTypeUniqueColumns>(this: T, uniqueColumnValues: T['internal']['uniqueColumns']): QueryTake<T> &
|
|
10060
|
+
findBy<T extends PickQueryResultReturnTypeUniqueColumns>(this: T, uniqueColumnValues: T['internal']['uniqueColumns']): QueryTake<T> & QueryHasWhere;
|
|
10137
10061
|
/**
|
|
10138
10062
|
* Finds a single unique record, returns `undefined` if not found.
|
|
10139
10063
|
* It accepts values of primary keys or unique indexes defined on the table.
|
|
@@ -10147,7 +10071,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10147
10071
|
*
|
|
10148
10072
|
* @param uniqueColumnValues - is derived from primary keys and unique indexes in the table
|
|
10149
10073
|
*/
|
|
10150
|
-
findByOptional<T extends PickQueryResultReturnTypeUniqueColumns>(this: T, uniqueColumnValues: T['internal']['uniqueColumns']): QueryTakeOptional<T> &
|
|
10074
|
+
findByOptional<T extends PickQueryResultReturnTypeUniqueColumns>(this: T, uniqueColumnValues: T['internal']['uniqueColumns']): QueryTakeOptional<T> & QueryHasWhere;
|
|
10151
10075
|
/**
|
|
10152
10076
|
* Specifies the schema to be used as a prefix of a table name.
|
|
10153
10077
|
*
|
|
@@ -10203,7 +10127,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10203
10127
|
*
|
|
10204
10128
|
* @param columns - column names or a raw SQL
|
|
10205
10129
|
*/
|
|
10206
|
-
group<T extends
|
|
10130
|
+
group<T extends PickQueryHasSelectResult>(this: T, ...columns: T['__hasSelect'] extends true ? GroupArgs<T> : {
|
|
10207
10131
|
error: 'select is required for group';
|
|
10208
10132
|
}[]): T;
|
|
10209
10133
|
/**
|
|
@@ -10325,7 +10249,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10325
10249
|
*
|
|
10326
10250
|
* @param fn - helper function
|
|
10327
10251
|
*/
|
|
10328
|
-
makeHelper<T extends
|
|
10252
|
+
makeHelper<T extends PickQuerySelectableShapeAs, Args extends unknown[], Result extends MergeQueryArg>(this: T, fn: (q: T, ...args: Args) => Result): QueryHelper<T, Args, Result>;
|
|
10329
10253
|
/**
|
|
10330
10254
|
* `useHelper` allows to use {@link makeHelper} in different queries:
|
|
10331
10255
|
*
|
|
@@ -10382,7 +10306,7 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10382
10306
|
*
|
|
10383
10307
|
* @param fn - function to useHelper the query with. The result type will be merged with the main query as if the `merge` method was used.
|
|
10384
10308
|
*/
|
|
10385
|
-
useHelper<T extends
|
|
10309
|
+
useHelper<T extends MergeQueryArg, Fn extends IsQueryHelperForTable<T['table']>>(this: T, fn: Fn, ...args: Fn['args']): Fn['result'] extends MergeQueryArg ? MergeQuery<T, Fn['result']> : Fn['result'];
|
|
10386
10310
|
/**
|
|
10387
10311
|
* `modify` is useful when you'd like to modify the query based on some condition.
|
|
10388
10312
|
*
|
|
@@ -10443,19 +10367,17 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
10443
10367
|
} : `narrowType() error: provided type does not extend the '${NarrowInvalidKeys<T, Narrow> & string}' column type` : (T['returnType'] extends 'pluck' ? Narrow extends unknown[] ? Narrow[number] : Narrow : Narrow) extends (T['returnType'] extends 'pluck' ? T['result']['pluck']['outputType'] : T['result']['value']['outputType']) ? {
|
|
10444
10368
|
[K in keyof T]: K extends 'result' ? T['returnType'] extends 'value' | 'valueOrThrow' ? NarrowValueTypeResult<T, Narrow> : NarrowPluckTypeResult<T, Narrow> : K extends 'then' ? QueryThenByQuery<T, T['returnType'] extends 'value' | 'valueOrThrow' ? NarrowValueTypeResult<T, Narrow> : NarrowPluckTypeResult<T, Narrow>> : T[K];
|
|
10445
10369
|
} : 'narrowType() error: provided type does not extend the returning column column type';
|
|
10446
|
-
if<T extends
|
|
10370
|
+
if<T extends PickQueryResultReturnType, R extends PickQueryResult>(this: T, condition: boolean | null | undefined, fn: (q: T) => R & {
|
|
10447
10371
|
returnType: T['returnType'];
|
|
10448
10372
|
}): QueryIfResult<T, R>;
|
|
10449
10373
|
queryRelated<T extends PickQueryRelations, RelName extends keyof T['relations']>(this: T, relName: RelName, params: T['relations'][RelName]['params']): T['relations'][RelName]['maybeSingle'];
|
|
10450
|
-
chain<T extends
|
|
10451
|
-
T['
|
|
10374
|
+
chain<T extends PickQuerySelectableShapeRelationsReturnTypeIsSubQuery, RelName extends keyof T['relations']>(this: T, relName: RelName): [
|
|
10375
|
+
T['__subQuery'],
|
|
10452
10376
|
T['returnType'],
|
|
10453
10377
|
T['relations'][RelName]['returnsOne']
|
|
10454
|
-
] extends [true, 'one' | 'oneOrThrow', true] ? {
|
|
10455
|
-
[K in keyof T['relations'][RelName]['maybeSingle']]: K extends '
|
|
10456
|
-
|
|
10457
|
-
} : T['relations'][RelName]['maybeSingle'][K];
|
|
10458
|
-
} : JoinResultRequireMain<T['relations'][RelName]['query'], Omit<T['meta']['selectable'], keyof T['shape']>>;
|
|
10378
|
+
] extends [true | undefined, 'one' | 'oneOrThrow', true] ? {
|
|
10379
|
+
[K in keyof T['relations'][RelName]['maybeSingle']]: K extends '__selectable' ? T['relations'][RelName]['maybeSingle']['__selectable'] & Omit<T['__selectable'], keyof T['shape']> : T['relations'][RelName]['maybeSingle'][K];
|
|
10380
|
+
} & IsSubQuery : JoinResultRequireMain<T['relations'][RelName]['query'], Omit<T['__selectable'], keyof T['shape']>>;
|
|
10459
10381
|
}
|
|
10460
10382
|
|
|
10461
10383
|
interface DbExtension {
|
|
@@ -10475,20 +10397,6 @@ interface DbDomainArg<ColumnTypes> {
|
|
|
10475
10397
|
interface DbDomainArgRecord {
|
|
10476
10398
|
[K: string]: DbDomainArg<any>;
|
|
10477
10399
|
}
|
|
10478
|
-
interface QueryInternal<SinglePrimaryKey = any, UniqueColumns = any, UniqueColumnNames = any, UniqueColumnTuples = any, UniqueConstraints = any> extends QueryInternalBase {
|
|
10479
|
-
singlePrimaryKey: SinglePrimaryKey;
|
|
10480
|
-
uniqueColumns: UniqueColumns;
|
|
10481
|
-
uniqueColumnNames: UniqueColumnNames;
|
|
10482
|
-
uniqueColumnTuples: UniqueColumnTuples;
|
|
10483
|
-
uniqueConstraints: UniqueConstraints;
|
|
10484
|
-
extensions?: DbExtension[];
|
|
10485
|
-
domains?: DbDomainArgRecord;
|
|
10486
|
-
generatorIgnore?: GeneratorIgnore;
|
|
10487
|
-
tableData: TableData;
|
|
10488
|
-
nowSQL?: string;
|
|
10489
|
-
callbackArg?: Query;
|
|
10490
|
-
selectAllCount: number;
|
|
10491
|
-
}
|
|
10492
10400
|
type SelectableFromShape<Shape extends Column.QueryColumns, Table extends string | undefined> = {
|
|
10493
10401
|
[K in keyof Shape]: {
|
|
10494
10402
|
as: K;
|
|
@@ -10503,32 +10411,40 @@ type SelectableFromShape<Shape extends Column.QueryColumns, Table extends string
|
|
|
10503
10411
|
type QueryReturnType = QueryReturnTypeAll | 'one' | 'oneOrThrow' | 'rows' | 'pluck' | 'value' | 'valueOrThrow' | 'void';
|
|
10504
10412
|
type QueryReturnTypeAll = undefined | 'all';
|
|
10505
10413
|
type QueryReturnTypeOptional = 'one' | 'value';
|
|
10414
|
+
interface QueryHasSelect {
|
|
10415
|
+
__hasSelect: true;
|
|
10416
|
+
}
|
|
10506
10417
|
interface IsQuery {
|
|
10507
10418
|
__isQuery: true;
|
|
10508
10419
|
}
|
|
10420
|
+
interface IsSubQuery {
|
|
10421
|
+
__subQuery: true;
|
|
10422
|
+
}
|
|
10509
10423
|
interface IsQueries {
|
|
10510
10424
|
[K: string]: IsQuery;
|
|
10511
10425
|
}
|
|
10512
|
-
interface QueryBase extends IsQuery, PickQueryShape {
|
|
10513
|
-
internal: QueryInternalBase;
|
|
10514
|
-
q: QueryDataBase;
|
|
10515
|
-
table?: string;
|
|
10516
|
-
}
|
|
10517
|
-
interface QueryBaseCommon<Scopes extends RecordKeyTrue = RecordKeyTrue> extends QueryBase {
|
|
10518
|
-
meta: QueryMetaBase<Scopes>;
|
|
10519
|
-
}
|
|
10520
10426
|
interface QueryOrExpression<T> {
|
|
10521
10427
|
result: {
|
|
10522
10428
|
value: Column.Pick.QueryColumnOfType<T>;
|
|
10523
10429
|
};
|
|
10524
10430
|
}
|
|
10525
|
-
interface
|
|
10526
|
-
|
|
10431
|
+
interface QuerySelectable {
|
|
10432
|
+
[K: PropertyKey]: {
|
|
10433
|
+
as: string;
|
|
10434
|
+
column: Column.Pick.QueryColumn;
|
|
10435
|
+
};
|
|
10436
|
+
}
|
|
10437
|
+
interface Query extends IsQuery, PickQueryTable, PickQueryShape, PickQuerySelectable, QueryMethods<unknown> {
|
|
10438
|
+
__as: string;
|
|
10439
|
+
__hasSelect: boolean;
|
|
10440
|
+
__hasWhere: boolean;
|
|
10441
|
+
__defaults: EmptyObject;
|
|
10442
|
+
__scopes: EmptyObject;
|
|
10443
|
+
__defaultSelect: PropertyKey;
|
|
10527
10444
|
result: Column.QueryColumns;
|
|
10528
10445
|
withData: WithDataItems;
|
|
10529
10446
|
baseQuery: Query;
|
|
10530
10447
|
internal: QueryInternal;
|
|
10531
|
-
meta: QueryMetaBase<EmptyObject>;
|
|
10532
10448
|
returnType: QueryReturnType;
|
|
10533
10449
|
qb: QueryBuilder;
|
|
10534
10450
|
columnTypes: unknown;
|
|
@@ -10541,136 +10457,103 @@ interface Query extends QueryBase, QueryMethods<unknown> {
|
|
|
10541
10457
|
relationQueries: IsQueries;
|
|
10542
10458
|
error: new (message: string, length: number, name: QueryErrorName) => QueryError;
|
|
10543
10459
|
}
|
|
10544
|
-
type SelectableOfType<T extends
|
|
10545
|
-
[K in keyof T['
|
|
10546
|
-
}[keyof T['
|
|
10547
|
-
type SelectableOrExpressionOfType<T extends
|
|
10460
|
+
type SelectableOfType<T extends PickQuerySelectable, Type> = {
|
|
10461
|
+
[K in keyof T['__selectable']]: T['__selectable'][K]['column']['type'] extends Type | null ? K : never;
|
|
10462
|
+
}[keyof T['__selectable']];
|
|
10463
|
+
type SelectableOrExpressionOfType<T extends PickQuerySelectable, C extends Column.Pick.Type> = SelectableOfType<T, C['type']> | Expression<Column.Pick.QueryColumnOfType<C['type'] | null>>;
|
|
10548
10464
|
declare const queryTypeWithLimitOne: RecordKeyTrue;
|
|
10549
|
-
interface QueryMetaHasSelect {
|
|
10550
|
-
meta: {
|
|
10551
|
-
hasSelect: true;
|
|
10552
|
-
};
|
|
10553
|
-
}
|
|
10554
10465
|
type SetQueryReturnsAll<T extends PickQueryResult> = {
|
|
10555
10466
|
[K in keyof T]: K extends 'returnType' ? 'all' : K extends 'then' ? QueryThenShallowSimplifyArr<ColumnsShape.Output<T['result']>> : T[K];
|
|
10556
|
-
} &
|
|
10557
|
-
type
|
|
10558
|
-
[K in keyof T]: K extends '
|
|
10559
|
-
|
|
10560
|
-
} : K extends 'returnType' ? 'all' : K extends 'then' ? QueryThenShallowSimplifyArr<ColumnsShape.Output<T['result']>> : T[K];
|
|
10561
|
-
} & QueryMetaHasWhere;
|
|
10562
|
-
type SetQueryReturnsAllKindResult<T extends PickQueryMetaResult, Kind extends string, Result extends Column.QueryColumns> = {
|
|
10563
|
-
[K in keyof T]: K extends 'meta' ? {
|
|
10564
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10565
|
-
} : K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K];
|
|
10566
|
-
} & QueryMetaHasWhere;
|
|
10467
|
+
} & QueryHasWhere;
|
|
10468
|
+
type SetQueryReturnsAllResult<T extends PickQueryResult, Result extends Column.QueryColumns> = {
|
|
10469
|
+
[K in keyof T]: K extends 'returnType' ? 'all' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplifyArr<T['result']> : T[K];
|
|
10470
|
+
} & QueryHasWhere;
|
|
10567
10471
|
type QueryTakeOptional<T extends PickQueryResultReturnType> = T['returnType'] extends 'value' | 'pluck' | 'void' ? T : T['returnType'] extends 'valueOrThrow' ? {
|
|
10568
10472
|
[K in keyof T]: K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<T['result']['value']['outputType'] | undefined> : T[K];
|
|
10569
10473
|
} : {
|
|
10570
10474
|
[K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape.Output<T['result']>> : T[K];
|
|
10571
10475
|
};
|
|
10476
|
+
type QueryManyTakeOptional<T extends PickQueryResultReturnType> = {
|
|
10477
|
+
[K in keyof T]: K extends 'returnType' ? 'one' : K extends 'then' ? QueryThenShallowSimplifyOptional<ColumnsShape.Output<T['result']>> : T[K];
|
|
10478
|
+
};
|
|
10572
10479
|
type QueryTake<T extends PickQueryResultReturnType> = T['returnType'] extends 'valueOrThrow' | 'pluck' | 'void' ? T : T['returnType'] extends 'value' ? {
|
|
10573
10480
|
[K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Exclude<T['result']['value']['outputType'], undefined>> : T[K];
|
|
10574
10481
|
} : {
|
|
10575
10482
|
[K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K];
|
|
10576
10483
|
};
|
|
10577
|
-
type
|
|
10578
|
-
[K in keyof T]: K extends '
|
|
10579
|
-
|
|
10580
|
-
|
|
10484
|
+
type QueryManyTake<T extends PickQueryResultReturnType> = {
|
|
10485
|
+
[K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K];
|
|
10486
|
+
};
|
|
10487
|
+
type SetQueryReturnsOne<T extends PickQueryResult> = {
|
|
10488
|
+
[K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<T['result']>> : T[K];
|
|
10581
10489
|
};
|
|
10582
|
-
type
|
|
10583
|
-
[K in keyof T]: K extends '
|
|
10584
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10585
|
-
} : K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<Result>> : T[K];
|
|
10490
|
+
type SetQueryReturnsOneResult<T extends PickQueryResult, Result extends Column.QueryColumns> = {
|
|
10491
|
+
[K in keyof T]: K extends 'returnType' ? 'oneOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThenShallowSimplify<ColumnsShape.Output<Result>> : T[K];
|
|
10586
10492
|
};
|
|
10587
10493
|
type SetQueryReturnsRows<T extends PickQueryResult> = {
|
|
10588
10494
|
[K in keyof T]: K extends 'returnType' ? 'rows' : K extends 'then' ? QueryThen<ColumnsShape.Output<T['result']>[keyof T['result']][][]> : T[K];
|
|
10589
10495
|
};
|
|
10590
|
-
type SetQueryReturnsPluck<T extends
|
|
10591
|
-
|
|
10496
|
+
type SetQueryReturnsPluck<T extends PickQuerySelectable, S extends keyof T['__selectable'] | Expression> = S extends keyof T['__selectable'] ? {
|
|
10497
|
+
[K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
|
|
10498
|
+
pluck: T['__selectable'][S]['column'];
|
|
10499
|
+
} : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['__selectable'][S]['column']['outputType'][]> : T[K];
|
|
10500
|
+
} : {
|
|
10501
|
+
[K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
|
|
10502
|
+
pluck: S extends Expression ? S['result']['value'] : never;
|
|
10503
|
+
} : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<(S extends Expression ? S['result']['value']['outputType'] : never)[]> : T[K];
|
|
10504
|
+
};
|
|
10505
|
+
type SetValueQueryReturnsPluckColumn<T extends PickQueryResult> = {
|
|
10592
10506
|
[K in keyof T]: K extends 'result' ? {
|
|
10593
|
-
pluck: C;
|
|
10594
|
-
} : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<C['outputType'][]> : T[K];
|
|
10595
|
-
} & QueryMetaHasSelect;
|
|
10596
|
-
type SetQueryReturnsPluckColumnKind<T extends PickQueryMetaResult, Kind extends string> = {
|
|
10597
|
-
[K in keyof T]: K extends 'meta' ? {
|
|
10598
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10599
|
-
} : K extends 'result' ? {
|
|
10600
10507
|
pluck: T['result']['value'];
|
|
10601
10508
|
} : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<T['result']['value']['outputType'][]> : T[K];
|
|
10602
|
-
} &
|
|
10603
|
-
type
|
|
10604
|
-
[K in keyof T]: K extends '
|
|
10605
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10606
|
-
} : K extends 'result' ? {
|
|
10509
|
+
} & QueryHasSelect;
|
|
10510
|
+
type SetQueryReturnsPluckColumnResult<T extends PickQueryResult, Result extends Column.QueryColumns> = {
|
|
10511
|
+
[K in keyof T]: K extends 'result' ? {
|
|
10607
10512
|
pluck: T['result']['value'];
|
|
10608
10513
|
} : K extends 'returnType' ? 'pluck' : K extends 'result' ? Result : K extends 'then' ? QueryThen<T['result']['value']['outputType'][]> : T[K];
|
|
10609
|
-
} &
|
|
10610
|
-
type SetQueryReturnsValueOrThrow<T extends
|
|
10611
|
-
type
|
|
10612
|
-
[K in keyof T]: K extends '
|
|
10613
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10614
|
-
} : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['outputType']> : T[K];
|
|
10514
|
+
} & QueryHasSelect;
|
|
10515
|
+
type SetQueryReturnsValueOrThrow<T extends PickQuerySelectable, Arg extends keyof T['__selectable']> = SetQueryReturnsColumnOrThrow<T, T['__selectable'][Arg]['column']> & T['__selectable'][Arg]['column']['operators'];
|
|
10516
|
+
type SetValueQueryReturnsValueOrThrow<T extends PickQueryResult> = {
|
|
10517
|
+
[K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['value']['outputType']> : T[K];
|
|
10615
10518
|
};
|
|
10616
|
-
type SetQueryReturnsValueOptional<T extends
|
|
10617
|
-
[K in keyof T['
|
|
10618
|
-
}> & Omit<T['
|
|
10519
|
+
type SetQueryReturnsValueOptional<T extends PickQuerySelectable, Arg extends GetStringArg<T>> = SetQueryReturnsColumnOptional<T, {
|
|
10520
|
+
[K in keyof T['__selectable'][Arg]['column']]: K extends 'outputType' ? T['__selectable'][Arg]['column'][K] | undefined : T['__selectable'][Arg]['column'][K];
|
|
10521
|
+
}> & Omit<T['__selectable'][Arg]['column']['operators'], 'equals' | 'not'> & Column.Modifiers.OperatorsNullable<T['__selectable'][Arg]['column']>;
|
|
10619
10522
|
type SetQueryReturnsColumnOrThrow<T, Column extends Column.Pick.OutputType> = {
|
|
10620
10523
|
[K in keyof T]: K extends 'result' ? {
|
|
10621
10524
|
value: Column;
|
|
10622
10525
|
} : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<Column['outputType']> : T[K];
|
|
10623
|
-
} &
|
|
10526
|
+
} & QueryHasSelect;
|
|
10624
10527
|
type SetQueryReturnsColumnOptional<T, Column extends Column.Pick.OutputType> = {
|
|
10625
10528
|
[K in keyof T]: K extends 'result' ? {
|
|
10626
10529
|
value: Column;
|
|
10627
10530
|
} : K extends 'returnType' ? 'value' : K extends 'then' ? QueryThen<Column['outputType'] | undefined> : T[K];
|
|
10628
|
-
} &
|
|
10629
|
-
type
|
|
10630
|
-
[K in keyof T]: K extends '
|
|
10631
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10632
|
-
} : K extends 'result' ? {
|
|
10531
|
+
} & QueryHasSelect;
|
|
10532
|
+
type SetQueryReturnsColumn<T extends PickQueryResult> = {
|
|
10533
|
+
[K in keyof T]: K extends 'result' ? {
|
|
10633
10534
|
value: T['result']['pluck'];
|
|
10634
10535
|
} : K extends 'returnType' ? 'valueOrThrow' : K extends 'then' ? QueryThen<T['result']['pluck']['outputType']> : T[K];
|
|
10635
|
-
} &
|
|
10636
|
-
type
|
|
10637
|
-
[K in keyof T]: K extends '
|
|
10638
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10639
|
-
} : K extends 'result' ? {
|
|
10536
|
+
} & QueryHasSelect;
|
|
10537
|
+
type SetQueryReturnsColumnResult<T extends PickQueryResult, Result extends Column.QueryColumns> = {
|
|
10538
|
+
[K in keyof T]: K extends 'result' ? {
|
|
10640
10539
|
value: T['result']['pluck'];
|
|
10641
10540
|
} : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? Result : K extends 'then' ? QueryThen<Result['pluck']['outputType']> : T[K];
|
|
10642
|
-
} &
|
|
10643
|
-
type SetQueryReturnsRowCount<T extends
|
|
10644
|
-
[K in keyof T]: K extends '
|
|
10645
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10646
|
-
} : K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
|
|
10541
|
+
} & QueryHasSelect;
|
|
10542
|
+
type SetQueryReturnsRowCount<T extends PickQueryResult> = {
|
|
10543
|
+
[K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
|
|
10647
10544
|
value: Column.Pick.QueryColumnOfType<number>;
|
|
10648
10545
|
} : K extends 'then' ? QueryThen<number> : T[K];
|
|
10649
10546
|
};
|
|
10650
|
-
type SetQueryReturnsRowCountMany<T extends
|
|
10651
|
-
[K in keyof T]: K extends '
|
|
10652
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10653
|
-
} : K extends 'returnType' ? 'pluck' : K extends 'result' ? {
|
|
10547
|
+
type SetQueryReturnsRowCountMany<T extends PickQueryResult> = {
|
|
10548
|
+
[K in keyof T]: K extends 'returnType' ? 'pluck' : K extends 'result' ? {
|
|
10654
10549
|
pluck: Column.Pick.QueryColumnOfType<number>;
|
|
10655
10550
|
} : K extends 'then' ? QueryThen<number> : T[K];
|
|
10656
10551
|
};
|
|
10657
10552
|
type SetQueryReturnsVoid<T> = {
|
|
10658
10553
|
[K in keyof T]: K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K];
|
|
10659
10554
|
};
|
|
10660
|
-
type
|
|
10661
|
-
[K in keyof T]: K extends '
|
|
10662
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10663
|
-
} : K extends 'returnType' ? 'void' : K extends 'then' ? QueryThen<void> : T[K];
|
|
10664
|
-
};
|
|
10665
|
-
type SetQueryKind<T extends PickQueryMeta, Kind extends string> = {
|
|
10666
|
-
[K in keyof T]: K extends 'meta' ? {
|
|
10667
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10668
|
-
} : T[K];
|
|
10669
|
-
};
|
|
10670
|
-
type SetQueryKindResult<T extends PickQueryMetaReturnType, Kind extends string, Result extends Column.QueryColumns> = {
|
|
10671
|
-
[K in keyof T]: K extends 'meta' ? {
|
|
10672
|
-
[K in keyof T['meta']]: K extends 'kind' ? Kind : T['meta'][K];
|
|
10673
|
-
} : K extends 'result' ? Result : K extends 'then' ? QueryThenByQuery<T, Result> : T[K];
|
|
10555
|
+
type SetQueryResult<T extends PickQueryReturnType, Result extends Column.QueryColumns> = {
|
|
10556
|
+
[K in keyof T]: K extends 'result' ? Result : K extends 'then' ? QueryThenByQuery<T, Result> : T[K];
|
|
10674
10557
|
};
|
|
10675
10558
|
interface ReturnsQueryOrExpression<T> {
|
|
10676
10559
|
(): QueryOrExpression<T>;
|
|
@@ -10686,7 +10569,7 @@ declare const isQuery: (q: unknown) => q is IsQuery;
|
|
|
10686
10569
|
interface RelationJoinQuery {
|
|
10687
10570
|
(joiningQuery: IsQuery, baseQuery: IsQuery): IsQuery;
|
|
10688
10571
|
}
|
|
10689
|
-
interface RelationConfigQuery extends
|
|
10572
|
+
interface RelationConfigQuery extends PickQueryResult, PickQuerySelectable, PickQueryShape, PickQueryTable, PickQueryAs {
|
|
10690
10573
|
}
|
|
10691
10574
|
interface RelationConfigBase extends IsQuery {
|
|
10692
10575
|
returnsOne: boolean;
|
|
@@ -10696,7 +10579,7 @@ interface RelationConfigBase extends IsQuery {
|
|
|
10696
10579
|
params: unknown;
|
|
10697
10580
|
queryRelated(params: unknown): unknown;
|
|
10698
10581
|
modifyRelatedQuery?(relatedQuery: IsQuery): (query: IsQuery) => void;
|
|
10699
|
-
maybeSingle:
|
|
10582
|
+
maybeSingle: PickQuerySelectableReturnType;
|
|
10700
10583
|
omitForeignKeyInCreate: PropertyKey;
|
|
10701
10584
|
dataForCreate?: RelationConfigDataForCreate;
|
|
10702
10585
|
optionalDataForCreate: unknown;
|
|
@@ -10716,8 +10599,80 @@ declare const isRelationQuery: (q: IsQuery) => q is RelationConfigBase;
|
|
|
10716
10599
|
interface PickQueryTable {
|
|
10717
10600
|
table?: string;
|
|
10718
10601
|
}
|
|
10719
|
-
interface
|
|
10720
|
-
|
|
10602
|
+
interface PickQueryThen {
|
|
10603
|
+
then: unknown;
|
|
10604
|
+
}
|
|
10605
|
+
interface PickQueryHasSelect {
|
|
10606
|
+
__hasSelect: boolean;
|
|
10607
|
+
}
|
|
10608
|
+
interface PickQueryHasWhere {
|
|
10609
|
+
__hasWhere: boolean;
|
|
10610
|
+
}
|
|
10611
|
+
interface PickQueryDefaults {
|
|
10612
|
+
__defaults: EmptyObject;
|
|
10613
|
+
}
|
|
10614
|
+
interface PickQueryTsQuery {
|
|
10615
|
+
__tsQuery?: string;
|
|
10616
|
+
}
|
|
10617
|
+
interface PickQueryScopes {
|
|
10618
|
+
__scopes: EmptyObject;
|
|
10619
|
+
}
|
|
10620
|
+
interface PickQueryDefaultSelect {
|
|
10621
|
+
__defaultSelect: PropertyKey;
|
|
10622
|
+
}
|
|
10623
|
+
interface PickQueryHasSelectResultReturnType extends PickQueryHasSelect, PickQueryResult, PickQueryReturnType {
|
|
10624
|
+
}
|
|
10625
|
+
interface PickQueryHasSelectResultShapeAs extends PickQueryHasSelect, PickQueryResult, PickQueryShape, PickQueryAs {
|
|
10626
|
+
}
|
|
10627
|
+
interface PickQueryHasSelectHasWhereResultReturnType extends PickQueryHasSelect, PickQueryHasWhere, PickQueryResult, PickQueryReturnType {
|
|
10628
|
+
}
|
|
10629
|
+
interface PickQueryHasSelectResult extends PickQueryHasSelect, PickQueryResult {
|
|
10630
|
+
}
|
|
10631
|
+
interface PickQuerySelectable {
|
|
10632
|
+
__selectable: QuerySelectable;
|
|
10633
|
+
}
|
|
10634
|
+
interface PickQuerySelectableResult extends PickQuerySelectable, PickQueryResult {
|
|
10635
|
+
}
|
|
10636
|
+
interface PickQuerySelectableRelations extends PickQuerySelectable, PickQueryRelations {
|
|
10637
|
+
}
|
|
10638
|
+
interface PickQuerySelectableRelationsResultReturnType extends PickQuerySelectableRelations, PickQueryResult, PickQueryReturnType {
|
|
10639
|
+
}
|
|
10640
|
+
interface PickQuerySelectableResultWindows extends PickQuerySelectable, PickQueryResult, PickQueryWindows {
|
|
10641
|
+
}
|
|
10642
|
+
interface PickQuerySelectableResultRelationsWindows extends PickQuerySelectableResult, PickQueryRelations, PickQueryWindows {
|
|
10643
|
+
}
|
|
10644
|
+
interface PickQueryMetaSelectableResultRelationsWindowsColumnTypes extends PickQuerySelectableResultRelationsWindows, PickQueryColumTypes {
|
|
10645
|
+
}
|
|
10646
|
+
interface PickQuerySelectableShapeAs extends PickQuerySelectable, PickQueryShape, PickQueryAs {
|
|
10647
|
+
}
|
|
10648
|
+
interface PickQueryTableMetaShapeTableAs extends PickQuerySelectableShapeAs, PickQueryTable {
|
|
10649
|
+
}
|
|
10650
|
+
interface PickQuerySelectableShapeRelationsWithData extends PickQuerySelectable, PickQueryShape, PickQueryRelations, PickQueryWithData {
|
|
10651
|
+
}
|
|
10652
|
+
interface PickQuerySelectableShapeRelationsWithDataAs extends PickQuerySelectableShapeRelationsWithData, PickQueryAs {
|
|
10653
|
+
}
|
|
10654
|
+
interface PickQuerySelectableShapeRelationsWithDataAsResultReturnType extends PickQuerySelectableShapeRelationsWithDataAs, PickQueryResult, PickQueryReturnType {
|
|
10655
|
+
}
|
|
10656
|
+
interface PickQuerySelectableResultReturnType extends PickQuerySelectable, PickQueryResult, PickQueryReturnType {
|
|
10657
|
+
}
|
|
10658
|
+
interface PickQuerySelectableResultRelationsWithDataReturnType extends PickQuerySelectable, PickQueryResult, PickQueryRelations, PickQueryWithData, PickQueryReturnType {
|
|
10659
|
+
}
|
|
10660
|
+
interface PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs extends PickQuerySelectableResultRelationsWithDataReturnType, PickQueryShape, PickQueryAs {
|
|
10661
|
+
}
|
|
10662
|
+
interface PickQuerySelectableShape extends PickQuerySelectable, PickQueryShape {
|
|
10663
|
+
}
|
|
10664
|
+
interface PickQuerySelectableColumnTypes extends PickQuerySelectable, PickQueryColumTypes {
|
|
10665
|
+
}
|
|
10666
|
+
interface PickQuerySelectableShapeRelationsReturnTypeIsSubQuery extends PickQueryIsSubQuery, PickQuerySelectable, PickQueryShape, PickQueryRelations, PickQueryReturnType {
|
|
10667
|
+
}
|
|
10668
|
+
interface PickQuerySelectableReturnType extends PickQuerySelectable, PickQueryReturnType {
|
|
10669
|
+
}
|
|
10670
|
+
interface PickQuerySelectableResultInputTypeAs extends PickQuerySelectableResult, PickQueryInputType, PickQueryAs {
|
|
10671
|
+
}
|
|
10672
|
+
interface PickQuerySelectableResultAs extends PickQuerySelectable, PickQueryResult, PickQueryAs {
|
|
10673
|
+
}
|
|
10674
|
+
interface PickQueryIsSubQuery {
|
|
10675
|
+
__subQuery?: boolean;
|
|
10721
10676
|
}
|
|
10722
10677
|
interface PickQueryResult {
|
|
10723
10678
|
result: Column.QueryColumns;
|
|
@@ -10730,10 +10685,6 @@ interface PickQueryReturnType {
|
|
|
10730
10685
|
}
|
|
10731
10686
|
interface PickQueryResultReturnType extends PickQueryResult, PickQueryReturnType {
|
|
10732
10687
|
}
|
|
10733
|
-
interface PickQueryMetaShape extends PickQueryMeta, PickQueryShape {
|
|
10734
|
-
}
|
|
10735
|
-
interface PickQueryMetaResult extends PickQueryMeta, PickQueryResult {
|
|
10736
|
-
}
|
|
10737
10688
|
interface PickQueryResultUniqueColumns extends PickQueryResult {
|
|
10738
10689
|
internal: {
|
|
10739
10690
|
uniqueColumns: unknown;
|
|
@@ -10748,23 +10699,8 @@ interface PickQueryUniqueProperties {
|
|
|
10748
10699
|
uniqueConstraints: unknown;
|
|
10749
10700
|
};
|
|
10750
10701
|
}
|
|
10751
|
-
interface PickQueryMetaResultWindows extends PickQueryMetaResult {
|
|
10752
|
-
windows: EmptyObject;
|
|
10753
|
-
}
|
|
10754
|
-
interface PickQueryTableMetaResult extends PickQueryTable, PickQueryMetaResult {
|
|
10755
|
-
}
|
|
10756
10702
|
interface PickQueryInputType {
|
|
10757
|
-
inputType:
|
|
10758
|
-
}
|
|
10759
|
-
interface PickQueryTableMetaResultInputType extends PickQueryTableMetaResult, PickQueryInputType {
|
|
10760
|
-
}
|
|
10761
|
-
interface PickQueryTableMetaShape extends PickQueryTable, PickQueryMetaShape {
|
|
10762
|
-
}
|
|
10763
|
-
interface PickQueryTableMetaResultShape extends PickQueryTableMetaResult, PickQueryMetaShape {
|
|
10764
|
-
}
|
|
10765
|
-
interface PickQueryMetaReturnType extends PickQueryMeta, PickQueryReturnType {
|
|
10766
|
-
}
|
|
10767
|
-
interface PickQueryMetaResultReturnType extends PickQueryMetaResult, PickQueryReturnType {
|
|
10703
|
+
inputType: RecordUnknown;
|
|
10768
10704
|
}
|
|
10769
10705
|
interface PickQueryWithData {
|
|
10770
10706
|
withData: WithDataItems;
|
|
@@ -10778,55 +10714,25 @@ interface PickQueryRelations {
|
|
|
10778
10714
|
interface PickQueryRelationQueries {
|
|
10779
10715
|
relationQueries: IsQueries;
|
|
10780
10716
|
}
|
|
10781
|
-
interface PickQueryMetaRelations extends PickQueryMeta, PickQueryRelations {
|
|
10782
|
-
}
|
|
10783
|
-
interface PickQueryMetaRelationsResult extends PickQueryMetaRelations, PickQueryResult {
|
|
10784
|
-
}
|
|
10785
|
-
interface PickQueryMetaRelationsReturnType extends PickQueryMetaRelationsResult, PickQueryResultReturnType {
|
|
10786
|
-
}
|
|
10787
|
-
interface PickQueryMetaShapeRelationsReturnType extends PickQueryMetaRelationsReturnType, PickQueryShape {
|
|
10788
|
-
}
|
|
10789
|
-
interface PickQueryMetaRelationsResultReturnType extends PickQueryMetaRelationsReturnType, PickQueryResult {
|
|
10790
|
-
}
|
|
10791
|
-
interface PickQueryMetaResultRelations extends PickQueryResult, PickQueryMeta, PickQueryRelations {
|
|
10792
|
-
}
|
|
10793
|
-
interface PickQueryMetaResultRelationsWindows extends PickQueryMetaResultRelations, PickQueryWindows {
|
|
10794
|
-
}
|
|
10795
10717
|
interface PickQueryColumTypes {
|
|
10796
10718
|
columnTypes: unknown;
|
|
10797
10719
|
}
|
|
10798
|
-
interface PickQueryMetaColumnTypes extends PickQueryMeta, PickQueryColumTypes {
|
|
10799
|
-
}
|
|
10800
|
-
interface PickQueryMetaResultRelationsWindowsColumnTypes extends PickQueryMetaResultRelationsWindows, PickQueryColumTypes {
|
|
10801
|
-
}
|
|
10802
10720
|
interface PickQueryWithDataColumnTypes extends PickQueryWithData, PickQueryColumTypes {
|
|
10803
10721
|
}
|
|
10804
10722
|
interface PickQueryResultColumnTypes extends PickQueryResult, PickQueryColumTypes {
|
|
10805
10723
|
}
|
|
10806
|
-
interface
|
|
10724
|
+
interface PickQueryAs {
|
|
10725
|
+
__as: string;
|
|
10807
10726
|
}
|
|
10808
|
-
interface
|
|
10727
|
+
interface PickQueryResultRelationsWithDataReturnTypeShape extends PickQueryResult, PickQueryRelations, PickQueryWithData, PickQueryReturnType, PickQueryShape {
|
|
10809
10728
|
}
|
|
10810
|
-
interface
|
|
10729
|
+
interface PickQueryMetaSelectableResultRelationsWithDataReturnTypeShapeAs extends PickQueryResult, PickQueryRelations, PickQueryWithData, PickQueryReturnType, PickQueryShape, PickQuerySelectable, PickQueryAs {
|
|
10811
10730
|
}
|
|
10812
|
-
interface
|
|
10813
|
-
}
|
|
10814
|
-
interface PickQueryRelationsWithData extends PickQueryWithData, PickQueryRelations {
|
|
10731
|
+
interface PickQueryResultAs extends PickQueryResult, PickQueryAs {
|
|
10815
10732
|
}
|
|
10816
|
-
interface
|
|
10733
|
+
interface PickQueryShapeAs extends PickQueryShape, PickQueryAs {
|
|
10817
10734
|
}
|
|
10818
|
-
interface
|
|
10819
|
-
}
|
|
10820
|
-
interface PickQueryMetaTableShapeReturnTypeWithData extends PickQueryMetaTableShape, PickQueryReturnType, PickQueryMetaWithData {
|
|
10821
|
-
}
|
|
10822
|
-
interface PickQueryMetaResultRelationsWithDataReturnTypeShape extends PickQueryMetaResultRelationsWithDataReturnType, PickQueryShape {
|
|
10823
|
-
}
|
|
10824
|
-
interface PickQueryMetaResultReturnTypeWithDataWindows extends PickQueryMetaResultReturnType, PickQueryWithData, PickQueryWindows {
|
|
10825
|
-
}
|
|
10826
|
-
interface PickQueryMetaResultReturnTypeWithDataWindowsThen extends PickQueryMetaResultReturnTypeWithDataWindows {
|
|
10827
|
-
then: unknown;
|
|
10828
|
-
}
|
|
10829
|
-
interface PickQueryTableMetaResultReturnTypeWithDataWindowsThen extends PickQueryMetaResultReturnTypeWithDataWindowsThen, PickQueryTable {
|
|
10735
|
+
interface PickQueryRelationsWithData extends PickQueryWithData, PickQueryRelations {
|
|
10830
10736
|
}
|
|
10831
10737
|
interface PickQuerySinglePrimaryKey {
|
|
10832
10738
|
internal: {
|
|
@@ -10866,13 +10772,13 @@ declare abstract class OrchidOrmError extends Error {
|
|
|
10866
10772
|
declare class NotFoundError extends OrchidOrmError {
|
|
10867
10773
|
#private;
|
|
10868
10774
|
constructor(query: IsQuery, message?: string);
|
|
10869
|
-
get query():
|
|
10775
|
+
get query(): Query;
|
|
10870
10776
|
}
|
|
10871
10777
|
declare class OrchidOrmInternalError extends Error {
|
|
10872
10778
|
#private;
|
|
10873
10779
|
data?: RecordUnknown | undefined;
|
|
10874
10780
|
constructor(query: IsQuery, message?: string, data?: RecordUnknown | undefined);
|
|
10875
|
-
get query():
|
|
10781
|
+
get query(): Query;
|
|
10876
10782
|
}
|
|
10877
10783
|
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';
|
|
10878
10784
|
declare abstract class QueryError<T extends PickQueryShape = PickQueryShape> extends OrchidOrmInternalError {
|
|
@@ -11032,9 +10938,9 @@ interface TransactionState {
|
|
|
11032
10938
|
/**
|
|
11033
10939
|
* Element of `afterCommit` transaction array. See {@link TransactionState.afterCommit}.
|
|
11034
10940
|
*/
|
|
11035
|
-
type TransactionAfterCommitHook = unknown[] |
|
|
10941
|
+
type TransactionAfterCommitHook = unknown[] | Query | AfterCommitHook[] | AfterCommitStandaloneHook;
|
|
11036
10942
|
interface AfterCommitHook {
|
|
11037
|
-
(data: unknown[], q:
|
|
10943
|
+
(data: unknown[], q: Query): unknown | Promise<unknown>;
|
|
11038
10944
|
}
|
|
11039
10945
|
interface AfterCommitStandaloneHook {
|
|
11040
10946
|
(): unknown | Promise<unknown>;
|
|
@@ -11073,4 +10979,4 @@ declare const testTransaction: {
|
|
|
11073
10979
|
close(arg: Arg): Promise<void>;
|
|
11074
10980
|
};
|
|
11075
10981
|
|
|
11076
|
-
export { type AdapterBase, type AdapterConfigBase, type AdapterConfigConnectRetry, type AddQueryDefaults, type AdditionalDateData, type AdditionalNumberData, type AdditionalStringData, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterCommitHook, type AfterCommitStandaloneHook, type AfterHook, type AggregateOptions, type AliasOrTable, type ArgWithBeforeAndBeforeSet, ArrayColumn, type ArrayColumnValue, type ArrayData, type ArrayMethodsData, type ArrayMethodsDataForBaseColumn, type AsQueryArg, type BaseNumberData, type BatchSql, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, ColumnsShape, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateFromMethodNames, type CreateManyFromMethodNames, type CreateManyMethodsNames, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, type CteArgsOptions, type CteHooks, type CteItem, type CteOptions, CteQuery, type CteQueryBuilder, type CteRecursiveOptions, type CteResult, type CteSqlResult, type CteTableHook, type CteTableHooks, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, type DelayedRelationSelect, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, type DynamicSQLArg, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionChain, type ExpressionData, type ExpressionOutput, ExpressionTypeMethod, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, type FnUnknownToUnknown, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratorIgnore, type GroupArgs, type HandleResult, type HasBeforeAndBeforeSet, type HasCteHooks, type HasHookSelect, type HasTableHook, type HavingItem, type HookAction, type HookSelect, type HookSelectArg, type HookSelectValue, type IdentityColumn, InetColumn, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQueries, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultFromArgs, type JoinResultRequireMain, type JoinResultSelectable, type JoinValueDedupItem, type JoinedParsers, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type MoveMutativeQueryToCte, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet, type OnConflictTarget, OnMethods, type Operator, type OperatorToSQL, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, type OrExpressionArg, OrchidOrmError, OrchidOrmInternalError, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickQueryBaseQuery, type PickQueryColumTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryInputType, type PickQueryInternal, type PickQueryMeta, type PickQueryMetaColumnTypes, type PickQueryMetaRelations, type PickQueryMetaRelationsResult, type PickQueryMetaRelationsResultReturnType, type PickQueryMetaRelationsReturnType, type PickQueryMetaResult, type PickQueryMetaResultRelations, type PickQueryMetaResultRelationsWindows, type PickQueryMetaResultRelationsWindowsColumnTypes, type PickQueryMetaResultRelationsWithDataReturnType, type PickQueryMetaResultRelationsWithDataReturnTypeShape, type PickQueryMetaResultReturnType, type PickQueryMetaResultReturnTypeWithDataWindows, type PickQueryMetaResultReturnTypeWithDataWindowsThen, type PickQueryMetaResultWindows, type PickQueryMetaReturnType, type PickQueryMetaShape, 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 PickQueryResult, type PickQueryResultColumnTypes, type PickQueryResultReturnType, type PickQueryResultReturnTypeUniqueColumns, type PickQueryResultUniqueColumns, type PickQueryReturnType, type PickQueryShape, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTable, type PickQueryTableMetaResult, type PickQueryTableMetaResultInputType, type PickQueryTableMetaResultReturnTypeWithDataWindowsThen, type PickQueryTableMetaResultShape, type PickQueryTableMetaShape, type PickQueryUniqueProperties, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type PrepareSubQueryForSql, type PrepareSubQueryForSqlArg, type Query, type QueryAfterHook, type QueryArraysResult, QueryAsMethods, type QueryBase, type QueryBaseCommon, type QueryBatchResult, type QueryBeforeHook, type QueryBeforeHookInternal, type QueryBuilder, type QueryCatch, type QueryCatchers, QueryClone, type QueryComputedArg, QueryCreate, QueryCreateFrom, type QueryData, type QueryDataAliases, type QueryDataBase, type QueryDataFromItem, type QueryDataJoinTo, type QueryDataScopes, type QueryDataSources, type QueryDataTransform, type QueryDataUnion, QueryError, type QueryErrorName, QueryExpressions, QueryGet, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryIfResultThen, type QueryInternal, type QueryInternalBase, type QueryInternalColumnNameToKey, type QueryInternalTableDataBase, QueryJoin, QueryLog, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryMetaBase, type QueryMetaHasSelect, type QueryMetaHasWhere, type QueryMetaIsSubQuery, QueryMethods, QueryOrCreate, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryResultRow, type QueryReturnType, type QueryReturnTypeAll, type QueryReturnTypeOptional, QueryScope, type QueryScopeData, type QueryScopes, type QuerySelectable, type QuerySourceItem, QuerySql, type QueryTake, type QueryTakeOptional, type QueryThen, type QueryThenByQuery, type QueryThenByReturnType, type QueryThenShallowSimplify, type QueryThenShallowSimplifyArr, type QueryThenShallowSimplifyOptional, QueryTransform, QueryWrap, type RawSQLValues, RawSql, type RawSqlBase, RealColumn, type RecordBoolean, type RecordKeyTrue, type RecordOfColumnsShapeBase, type RecordOptionalString, type RecordString, type RecordUnknown, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RunAfterQuery, type RuntimeComputedQueryColumn, type SQLArgs, type SQLQueryArgs, type ScopeArgumentQuery, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsArg, type SelectAsFnArg, type SelectAsValue, type SelectItem, type SelectSelf, 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 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 SetQueryReturnsValueOrThrowKind, type SetQueryReturnsVoid, type SetQueryReturnsVoidKind, type SetQueryTableAlias, type ShallowSimplify, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type SortDir, type Sql, type SqlCommonOptions, type SqlFn, type StaticSQLArgs, StringColumn$1 as StringColumn, type StringData, type SubQueryForSql, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TableHook, type TemplateLiteralArgs, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, type TimeInterval, TimestampColumn, type TimestampHelpers, TimestampTZColumn, type Timestamps, type TopCTE, Transaction, type TransactionAfterCommitHook, type TransactionOptions, type TransactionState, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, type UnionItem, type UnionKind, type UnionSet, type UnionToIntersection, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, 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 WindowDeclaration, type WindowItem, type WithConfig, type WithConfigs, type WithDataItem, type WithDataItems, type WithItems, type WrapQueryArg, XMLColumn, _addToHookSelect, _addToHookSelectWithTable, _applyRelationAliases, _checkIfAliased, _clone, _copyQueryAliasToQuery, _getQueryAliasOrName, _getQueryAs, _getQueryFreeAlias, _getQueryOuterAliases, _initQueryBuilder, _join, _joinLateral, _joinLateralProcessArg, _joinReturningArgs, _orCreate, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateForEachFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateOneFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertOneFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _querySelectAll, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotExists, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, _setQueryAlias, _setQueryAs, _setSubQueryAliases, _with, addCode, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, addTopCte, addValue, addWithToSql, anyShape, applyBatchTransforms, applyComputedColumns, applyMixins, applyTransforms, arrayDataToCode, arrayMethodNames, assignDbDataToColumn, backtickQuote, callWithThis, checkIfASimpleQuery, cloneQueryBaseUnscoped, codeToString, colors, columnCheckToCode, columnCode, columnDefaultArgumentToCode, columnErrorMessagesToCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnMethodsToCode, columnsShapeToCode, commitSql, composeCteSingleSql, constraintInnerToCode, constraintToCode, consumeColumnName, countSelect, createCtx, createDbWithAdapter, createSelect, cteToSql, ctesToSql, dateDataToCode, dateMethodNames, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, extendQuery, filterResult, finalizeNestedHookSelect, foreignKeyArgumentToCode, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDefaultLanguage, getDefaultNowFn, getFreeAlias, getFreeSetAlias, getFromSelectColumns, getFullColumnTable, getImportPath, getPrimaryKeys, getQueryAs, getSearchLang, getSearchText, getShapeFromSelect, getSqlText, getStackTrace, getTopCteSize, handleManyData, handleOneData, handleResult, havingToSql, identityToCode, indexInnerToCode, indexToCode, insert, isDefaultTimeStamp, isExpression, isInUserTransaction, isIterable, isObjectEmpty, isQuery, isQueryReturnsAll, isRawSQL, isRelationQuery, isTemplateLiteralArgs, joinSubQuery, joinTruthy, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeFnExpression, makeInsertSql, makeReturningSql, makeRowToJson, moveMutativeQueryToCte, newDelayedRelationSelect, noop, numberDataToCode, numberMethodNames, objectHasValues, omit, orderByToSql, parseRecord, parseTableData, parseTableDataInput, pathToLog, performQuery, pick, pluralize, postgisTypmodToSql, prepareOpArg, prepareSubQueryForSql, prependTopCte, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processJoinItem, processSelectArg, pushColumnData, pushHavingSql, pushJoinSql, pushOrNewArray, pushOrNewArrayToObjectImmutable, pushOrderBySql, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, pushUnionSql, pushWhereStatementSql, pushWhereToSql, queryColumnNameToKey, queryFrom, queryFromSql, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, quoteObjectKey, quoteSchemaAndTable, raw, rawSqlToCode, referencesArgsToCode, requirePrimaryKeys, resetDefaultNowFn, resolveSubQueryCallback, returnArg, rollbackSql, saveAliasedShape, searchSourcesToSql, selectAllSql, selectToSql, selectToSqlList, setColumnData, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setConnectRetryConfig, setCurrentColumnName, setDataValue, setDb, setDefaultLanguage, setDefaultNowFn, setDelayedRelation, setFreeAlias, setMoveMutativeQueryToCte, setObjectValueImmutable, setParserForSelectedString, setPrepareSubQueryForSql, setQueryObjectValueImmutable, setQueryOperators, setRawSqlPrepareSubQueryForSql, setSqlCtxSelectList, setTopCteSize, singleQuote, singleQuoteArray, snakeCaseKey, spreadObjectValues, sqlFn, sqlQueryArgsToExpression, stringDataToCode, stringMethodNames, tableDataMethods, templateLiteralSQLToCode, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, throwOnReadOnly, timestampHelpers, toArray, toCamelCase, toPascalCase, toSnakeCase, whereToSql, windowToSql, wrapAdapterFnWithConnectRetry };
|
|
10982
|
+
export { type AdapterBase, type AdapterConfigBase, type AdapterConfigConnectRetry, type AddQueryDefaults, type AdditionalDateData, type AdditionalNumberData, type AdditionalStringData, AfterCommitError, type AfterCommitErrorFulfilledResult, type AfterCommitErrorHandler, type AfterCommitErrorRejectedResult, type AfterCommitErrorResult, type AfterCommitHook, type AfterCommitStandaloneHook, type AfterHook, type AggregateOptions, type ArgWithBeforeAndBeforeSet, ArrayColumn, type ArrayColumnValue, type ArrayData, type ArrayMethodsData, type ArrayMethodsDataForBaseColumn, type AsQueryArg, type BaseNumberData, type BatchSql, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, type ChangeCountArg, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, ColumnRefExpression, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, ColumnsShape, ComputedColumn, type ComputedColumns, type ComputedColumnsFromOptions, type ComputedMethods, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateBelongsToData, type CreateColumn, type CreateCtx, type CreateData, type CreateFromMethodNames, type CreateManyFromMethodNames, type CreateManyMethodsNames, type CreateMethodsNames, type CreateRelationsData, type CreateRelationsDataOmittingFKeys, type CreateResult, type CreateSelf, type CteArgsOptions, type CteHooks, type CteItem, type CteOptions, CteQuery, type CteQueryBuilder, type CteRecursiveOptions, type CteResult, type CteSqlResult, type CteTableHook, type CteTableHooks, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, type DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbDomainArgRecord, type DbExtension, type DbOptions, type DbOptionsWithAdapter, type DbResult, type DbSharedOptions, type DbSqlQuery, type DbStructureDomainsMap, type DbTableConstructor, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultSchemaConfig, type DelayedRelationSelect, Delete, type DeleteArgs, type DeleteMethodsNames, type DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, type DynamicSQLArg, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type ExpressionChain, type ExpressionData, type ExpressionOutput, ExpressionTypeMethod, FnExpression, type FnExpressionArgs, type FnExpressionArgsPairs, type FnExpressionArgsValue, type FnUnknownToUnknown, type FromArg, FromMethods, type FromQuerySelf, type FromResult, type GeneratorIgnore, type GroupArgs, type HandleResult, type HasBeforeAndBeforeSet, type HasCteHooks, type HasHookSelect, type HasTableHook, type HavingItem, type HookAction, type HookSelect, type HookSelectArg, type HookSelectValue, type IdentityColumn, InetColumn, type InsertQueryDataObjectValues, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQueries, type IsQuery, type IsSubQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinArgToQuery, type JoinArgs, type JoinCallback, type JoinFirstArg, type JoinItem, type JoinItemArgs, type JoinLateralResult, type JoinQueryBuilder, type JoinQueryMethod, type JoinResult, type JoinResultFromArgs, type JoinResultRequireMain, type JoinResultSelectable, type JoinValueDedupItem, type JoinedParsers, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, type MergeQueryArg, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, type MoveMutativeQueryToCte, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, type NumericColumns, type OnConflictMerge, OnConflictQueryBuilder, type OnConflictSet, type OnConflictTarget, OnMethods, type Operator, type OperatorToSQL, Operators, type OperatorsAny, type OperatorsArray, type OperatorsBoolean, type OperatorsDate, type OperatorsJson, type OperatorsNumber, type OperatorsOrdinalText, type OperatorsText, type OperatorsTime, type OrCreateArg, OrExpression, type OrExpressionArg, OrchidOrmError, OrchidOrmInternalError, type OrderItem, type OrderTsQueryConfig, type Over, PathColumn, type PickQueryAs, type PickQueryBaseQuery, type PickQueryColumTypes, type PickQueryDataShapeAndJoinedShapes, type PickQueryDataShapeAndJoinedShapesAndAliases, type PickQueryDefaultSelect, type PickQueryDefaults, type PickQueryHasSelect, type PickQueryHasSelectHasWhereResultReturnType, type PickQueryHasSelectResult, type PickQueryHasSelectResultReturnType, type PickQueryHasSelectResultShapeAs, type PickQueryHasWhere, type PickQueryInputType, type PickQueryInternal, type PickQueryIsSubQuery, type PickQueryMetaSelectableResultRelationsWindowsColumnTypes, type PickQueryMetaSelectableResultRelationsWithDataReturnTypeShapeAs, type PickQueryQ, type PickQueryQAndBaseQuery, type PickQueryQAndInternal, type PickQueryRelationQueries, type PickQueryRelations, type PickQueryRelationsWithData, type PickQueryResult, type PickQueryResultAs, type PickQueryResultColumnTypes, type PickQueryResultRelationsWithDataReturnTypeShape, type PickQueryResultReturnType, type PickQueryResultReturnTypeUniqueColumns, type PickQueryResultUniqueColumns, type PickQueryReturnType, type PickQueryScopes, type PickQuerySelectable, type PickQuerySelectableColumnTypes, type PickQuerySelectableRelations, type PickQuerySelectableRelationsResultReturnType, type PickQuerySelectableResult, type PickQuerySelectableResultAs, type PickQuerySelectableResultInputTypeAs, type PickQuerySelectableResultRelationsWindows, type PickQuerySelectableResultRelationsWithDataReturnType, type PickQuerySelectableResultRelationsWithDataReturnTypeShapeAs, type PickQuerySelectableResultReturnType, type PickQuerySelectableResultWindows, type PickQuerySelectableReturnType, type PickQuerySelectableShape, type PickQuerySelectableShapeAs, type PickQuerySelectableShapeRelationsReturnTypeIsSubQuery, type PickQuerySelectableShapeRelationsWithData, type PickQuerySelectableShapeRelationsWithDataAs, type PickQuerySelectableShapeRelationsWithDataAsResultReturnType, type PickQueryShape, type PickQueryShapeAs, type PickQueryShapeResultReturnTypeSinglePrimaryKey, type PickQueryShapeResultSinglePrimaryKey, type PickQueryShapeSinglePrimaryKey, type PickQuerySinglePrimaryKey, type PickQueryTable, type PickQueryTableMetaShapeTableAs, type PickQueryThen, type PickQueryTsQuery, type PickQueryUniqueProperties, type PickQueryWindows, type PickQueryWithData, type PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type PostgisPoint, type PrepareSubQueryForSql, type PrepareSubQueryForSqlArg, type Query, type QueryAfterHook, type QueryArraysResult, QueryAsMethods, type QueryBatchResult, type QueryBeforeHook, type QueryBeforeHookInternal, type QueryBuilder, type QueryCatch, type QueryCatchers, QueryClone, type QueryComputedArg, QueryCreate, QueryCreateFrom, type QueryData, type QueryDataAliases, type QueryDataFromItem, type QueryDataJoinTo, type QueryDataScopes, type QueryDataSources, type QueryDataTransform, type QueryDataUnion, QueryError, type QueryErrorName, QueryExpressions, QueryGet, type QueryHasSelect, type QueryHasWhere, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryIfResultThen, type QueryInternal, type QueryInternalColumnNameToKey, QueryJoin, QueryLog, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, QueryMethods, QueryOrCreate, type QueryOrExpression, type QueryOrExpressionBooleanOrNullResult, type QueryResult, type QueryResultRow, type QueryReturnType, type QueryReturnTypeAll, type QueryReturnTypeOptional, QueryScope, type QueryScopeData, type QueryScopes, type QuerySelectable, type QuerySourceItem, QuerySql, type QueryTake, type QueryTakeOptional, type QueryThen, type QueryThenByQuery, type QueryThenByReturnType, type QueryThenShallowSimplify, type QueryThenShallowSimplifyArr, type QueryThenShallowSimplifyOptional, QueryTransform, QueryWrap, type RawSQLValues, RawSql, type RawSqlBase, RealColumn, type RecordBoolean, type RecordKeyTrue, type RecordOfColumnsShapeBase, type RecordOptionalString, type RecordString, type RecordUnknown, RefExpression, type RelationConfigBase, type RelationConfigDataForCreate, type RelationConfigQuery, type RelationJoinQuery, type RelationsBase, type ReturnsQueryOrExpression, type RunAfterQuery, type RuntimeComputedQueryColumn, type SQLArgs, type SQLQueryArgs, type ScopeArgumentQuery, type SearchWeight, type SearchWeightRecord, Select, type SelectArg, type SelectArgs, type SelectAs, type SelectAsArg, type SelectAsFnArg, type SelectAsValue, type SelectItem, type SelectSelf, type SelectSubQueryResult, type SelectableFromShape, type SelectableOfType, type SelectableOrExpression, type SelectableOrExpressionOfType, type SelectableOrExpressions, SerialColumn, type SerialColumnData, type SetQueryResult, type SetQueryReturnsAll, type SetQueryReturnsAllResult, type SetQueryReturnsColumn, type SetQueryReturnsColumnOptional, type SetQueryReturnsColumnOrThrow, type SetQueryReturnsColumnResult, type SetQueryReturnsOne, type SetQueryReturnsOneResult, type SetQueryReturnsPluck, type SetQueryReturnsPluckColumnResult, type SetQueryReturnsRowCount, type SetQueryReturnsRowCountMany, type SetQueryReturnsRows, type SetQueryReturnsValueOptional, type SetQueryReturnsValueOrThrow, type SetQueryReturnsVoid, type SetQueryTableAlias, type SetValueQueryReturnsPluckColumn, type SetValueQueryReturnsValueOrThrow, type ShallowSimplify, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SimpleJoinItemNonSubQueryArgs, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type SortDir, type Sql, type SqlCommonOptions, type SqlFn, type StaticSQLArgs, StringColumn$1 as StringColumn, type StringData, type SubQueryForSql, TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TableHook, type TemplateLiteralArgs, TextBaseColumn, TextColumn, type TextColumnData, Then, TimeColumn, type TimeInterval, TimestampColumn, type TimestampHelpers, TimestampTZColumn, type Timestamps, type TopCTE, Transaction, type TransactionAfterCommitHook, type TransactionOptions, type TransactionState, TsQueryColumn, TsVectorColumn, UUIDColumn, UnhandledTypeError, type UnionItem, type UnionKind, type UnionSet, type UnionToIntersection, type UniqueConstraints, type UniqueQueryTypeOrExpression, type UniqueTableDataItem, UnknownColumn, Update, type UpdateArg, type UpdateCtx, type UpdateCtxCollect, type UpdateData, type UpdateQueryDataItem, type UpdateQueryDataObject, type UpdateSelf, type UpdatedAtDataInjector, 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 WhereSearchItem, type WindowDeclaration, type WindowItem, type WithConfig, type WithConfigs, type WithDataItem, type WithDataItems, type WithItems, type WrapQueryArg, XMLColumn, _addToHookSelect, _addToHookSelectWithTable, _applyRelationAliases, _checkIfAliased, _clone, _copyQueryAliasToQuery, _getQueryAliasOrName, _getQueryAs, _getQueryFreeAlias, _getQueryOuterAliases, _initQueryBuilder, _join, _joinLateral, _joinLateralProcessArg, _joinReturningArgs, _orCreate, _queryAfterSaveCommit, _queryAll, _queryChangeCounter, _queryCreate, _queryCreateForEachFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateOneFrom, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertForEachFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertOneFrom, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _querySelectAll, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotExists, _queryWhereNotOneOf, _queryWhereNotSql, _queryWhereOneOf, _queryWhereSql, _runAfterCommitHooks, _setQueryAlias, _setQueryAs, _setSubQueryAliases, _with, addCode, addColumnParserToQuery, addParserForRawExpression, addParserForSelectItem, addQueryOn, addTopCte, addValue, addWithToSql, anyShape, applyBatchTransforms, applyComputedColumns, applyMixins, applyTransforms, arrayDataToCode, arrayMethodNames, assignDbDataToColumn, backtickQuote, callWithThis, checkIfASimpleQuery, cloneQueryBaseUnscoped, codeToString, colors, columnCheckToCode, columnCode, columnDefaultArgumentToCode, columnErrorMessagesToCode, columnExcludesToCode, columnForeignKeysToCode, columnIndexesToCode, columnMethodsToCode, columnsShapeToCode, commitSql, composeCteSingleSql, constraintInnerToCode, constraintToCode, consumeColumnName, countSelect, createCtx, createDbWithAdapter, createSelect, cteToSql, ctesToSql, dateDataToCode, dateMethodNames, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForLog, escapeForMigration, escapeString, excludeInnerToCode, excludeToCode, exhaustive, extendQuery, filterResult, finalizeNestedHookSelect, foreignKeyArgumentToCode, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnTypes, getDefaultLanguage, getDefaultNowFn, getFreeAlias, getFreeSetAlias, getFromSelectColumns, getFullColumnTable, getImportPath, getPrimaryKeys, getQueryAs, getSearchLang, getSearchText, getShapeFromSelect, getSqlText, getStackTrace, getTopCteSize, handleManyData, handleOneData, handleResult, havingToSql, identityToCode, indexInnerToCode, indexToCode, insert, isDefaultTimeStamp, isExpression, isInUserTransaction, isIterable, isObjectEmpty, isQuery, isQueryReturnsAll, isRawSQL, isRelationQuery, isTemplateLiteralArgs, joinSubQuery, joinTruthy, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeFnExpression, makeInsertSql, makeReturningSql, makeRowToJson, moveMutativeQueryToCte, newDelayedRelationSelect, noop, numberDataToCode, numberMethodNames, objectHasValues, omit, orderByToSql, parseRecord, parseTableData, parseTableDataInput, pathToLog, performQuery, pick, pluralize, postgisTypmodToSql, prepareOpArg, prepareSubQueryForSql, prependTopCte, primaryKeyInnerToCode, processComputedBatches, processComputedResult, processJoinItem, processSelectArg, pushColumnData, pushHavingSql, pushJoinSql, pushOrNewArray, pushOrNewArrayToObjectImmutable, pushOrderBySql, pushQueryArrayImmutable, pushQueryOn, pushQueryOnForOuter, pushQueryOrOn, pushQueryValueImmutable, pushTableDataCode, pushUnionSql, pushWhereStatementSql, pushWhereToSql, queryColumnNameToKey, queryFrom, queryFromSql, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, quoteObjectKey, quoteSchemaAndTable, raw, rawSqlToCode, referencesArgsToCode, requirePrimaryKeys, resetDefaultNowFn, resolveSubQueryCallback, returnArg, rollbackSql, saveAliasedShape, searchSourcesToSql, selectAllSql, selectToSql, selectToSqlList, setColumnData, setColumnDefaultParse, setColumnEncode, setColumnParse, setColumnParseNull, setConnectRetryConfig, setCurrentColumnName, setDataValue, setDb, setDefaultLanguage, setDefaultNowFn, setDelayedRelation, setFreeAlias, setMoveMutativeQueryToCte, setObjectValueImmutable, setParserForSelectedString, setPrepareSubQueryForSql, setQueryObjectValueImmutable, setQueryOperators, setRawSqlPrepareSubQueryForSql, setSqlCtxSelectList, setTopCteSize, singleQuote, singleQuoteArray, snakeCaseKey, spreadObjectValues, sqlFn, sqlQueryArgsToExpression, stringDataToCode, stringMethodNames, tableDataMethods, templateLiteralSQLToCode, templateLiteralToSQL, testTransaction, throwIfJoinLateral, throwIfNoWhere, throwOnReadOnly, timestampHelpers, toArray, toCamelCase, toPascalCase, toSnakeCase, whereToSql, windowToSql, wrapAdapterFnWithConnectRetry };
|