pqb 0.66.8 → 0.67.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bun.d.ts +27 -0
- package/dist/bun.js +241 -0
- package/dist/bun.js.map +1 -0
- package/dist/bun.mjs +238 -0
- package/dist/bun.mjs.map +1 -0
- package/dist/index.d.ts +248 -211
- package/dist/index.js +8967 -8905
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8964 -8906
- package/dist/index.mjs.map +1 -1
- package/dist/internal.d.ts +2 -2
- package/dist/internal.js +24 -0
- package/dist/internal.mjs +2 -2
- package/dist/node-postgres.d.ts +3 -2
- package/dist/node-postgres.js +18 -11
- package/dist/node-postgres.js.map +1 -1
- package/dist/node-postgres.mjs +19 -13
- package/dist/node-postgres.mjs.map +1 -1
- package/dist/postgres-js.js +31 -16
- package/dist/postgres-js.js.map +1 -1
- package/dist/postgres-js.mjs +31 -16
- package/dist/postgres-js.mjs.map +1 -1
- package/package.json +13 -1
package/dist/index.d.ts
CHANGED
|
@@ -351,22 +351,28 @@ interface ProcessedStorageOptions extends SqlSessionState {
|
|
|
351
351
|
declare class QueryStorage {
|
|
352
352
|
withOptions<Result>(this: PickQueryQAndInternal, options: StorageOptions, cb: () => Promise<Result>): Promise<Result>;
|
|
353
353
|
}
|
|
354
|
+
interface PostgresInterval {
|
|
355
|
+
years: number;
|
|
356
|
+
months: number;
|
|
357
|
+
days: number;
|
|
358
|
+
hours: number;
|
|
359
|
+
minutes: number;
|
|
360
|
+
seconds: number;
|
|
361
|
+
milliseconds: number;
|
|
362
|
+
}
|
|
354
363
|
/**
|
|
355
364
|
* Generic result returning from query methods.
|
|
356
365
|
*/
|
|
357
366
|
interface QueryResultRow {
|
|
358
367
|
[K: string]: any;
|
|
359
368
|
}
|
|
360
|
-
interface QueryResult<T
|
|
369
|
+
interface QueryResult<T = any> {
|
|
361
370
|
rowCount: number;
|
|
362
371
|
rows: T[];
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
interface QueryArraysResult<R extends any[] = any[]> {
|
|
368
|
-
rowCount: number;
|
|
369
|
-
rows: R[];
|
|
372
|
+
/**
|
|
373
|
+
* node-postgres and postgres-js: fields are present even for empty results.
|
|
374
|
+
* Bun doesn't implement fields in the same way, fields are empty if no rows returned.
|
|
375
|
+
*/
|
|
370
376
|
fields: {
|
|
371
377
|
name: string;
|
|
372
378
|
}[];
|
|
@@ -461,7 +467,7 @@ interface Adapter {
|
|
|
461
467
|
isInTransaction(this: Adapter): this is TransactionAdapter;
|
|
462
468
|
assignError(to: QueryError, from: Error): void;
|
|
463
469
|
query<T extends QueryResultRow = QueryResultRow>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<QueryResult<T>>;
|
|
464
|
-
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<
|
|
470
|
+
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<QueryResult<R>>;
|
|
465
471
|
/**
|
|
466
472
|
* Run a transaction
|
|
467
473
|
*
|
|
@@ -492,17 +498,25 @@ interface TransactionAdapter extends Adapter {
|
|
|
492
498
|
}
|
|
493
499
|
type Pool = any;
|
|
494
500
|
type Client = any;
|
|
501
|
+
interface AdapterSchemaConfigOptions {
|
|
502
|
+
jsonEncodedByDriver?: boolean;
|
|
503
|
+
dateParsedByDriver?: boolean;
|
|
504
|
+
arrayEncode?(input: unknown): unknown;
|
|
505
|
+
intervalParse?(input: string): PostgresInterval;
|
|
506
|
+
}
|
|
495
507
|
/**
|
|
496
508
|
* Adapter class used by runtime orchestrator to create driver-specific adapters.
|
|
497
509
|
*/
|
|
498
510
|
interface DriverAdapter {
|
|
511
|
+
noFieldsForArrays?: boolean;
|
|
512
|
+
schemaConfig?: AdapterSchemaConfigOptions;
|
|
499
513
|
errorClass: new (...args: any[]) => Error;
|
|
500
514
|
errorFields: RecordString;
|
|
501
515
|
configure(config: AdapterConfigBase): Pool;
|
|
502
516
|
manualPool: boolean;
|
|
503
517
|
borrow(pool: Pool): Client;
|
|
504
518
|
release(client: Client): void;
|
|
505
|
-
queryClient<T
|
|
519
|
+
queryClient<T = QueryResultRow>(client: Client, text: string, values?: unknown[], arraysMode?: boolean): Promise<QueryResult<T>>;
|
|
506
520
|
begin<DriverClient, Result>(pool: Pool, cb: (client: DriverClient) => Promise<Result>, options?: string): Promise<Result>;
|
|
507
521
|
savepoint<T>(client: Client, setClient: (client: Client) => void, name: string, cb: () => Promise<T>): Promise<T>;
|
|
508
522
|
hackySavepoint<T extends QueryResultRow>(client: Client, setClient: (client: Client) => void, state: HackySavepointState, text: string, values?: unknown[], arraysMode?: boolean): Promise<QueryResult<T>>;
|
|
@@ -533,7 +547,7 @@ declare class AdapterClass implements Adapter {
|
|
|
533
547
|
private readonly connectionState;
|
|
534
548
|
constructor(params: AdapterParams);
|
|
535
549
|
query<T extends QueryResultRow = QueryResultRow>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<QueryResult<T>>;
|
|
536
|
-
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<
|
|
550
|
+
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<QueryResult<R>>;
|
|
537
551
|
clone(params?: AdapterConfigBase): Adapter;
|
|
538
552
|
isInTransaction(this: Adapter): this is TransactionAdapter;
|
|
539
553
|
getDatabase(): string;
|
|
@@ -563,7 +577,7 @@ declare class TransactionAdapterClass implements TransactionAdapter {
|
|
|
563
577
|
driverAdapter: DriverAdapter;
|
|
564
578
|
constructor(adapter: Adapter, client: Client);
|
|
565
579
|
query<T extends QueryResultRow = QueryResultRow>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<QueryResult<T>>;
|
|
566
|
-
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<
|
|
580
|
+
arrays<R extends any[] = any[]>(text: string, values?: unknown[], sqlSessionState?: SqlSessionState): Promise<QueryResult<R>>;
|
|
567
581
|
clone(params?: AdapterConfigBase): Adapter;
|
|
568
582
|
isInTransaction(this: Adapter): this is TransactionAdapter;
|
|
569
583
|
getDatabase(): string;
|
|
@@ -589,6 +603,7 @@ interface AfterCommitStandaloneHook {
|
|
|
589
603
|
}
|
|
590
604
|
declare const makeConnectRetryConfig: (config: AdapterConfigConnectRetryParam) => AdapterConfigConnectRetry;
|
|
591
605
|
declare const wrapAdapterFnWithConnectRetry: <Fn extends (...args: any[]) => any>(connectRetryConfig: AdapterConfigConnectRetry, fn: Fn) => Fn;
|
|
606
|
+
declare const getDriverErrorCode: (err: object) => unknown;
|
|
592
607
|
/**
|
|
593
608
|
* Expression for a SQL identifier reference.
|
|
594
609
|
* Used to safely quote identifiers in raw SQL queries.
|
|
@@ -625,7 +640,11 @@ interface ColumnTypeSchemaArg {
|
|
|
625
640
|
narrowAllTypes: unknown;
|
|
626
641
|
error?: unknown;
|
|
627
642
|
}
|
|
643
|
+
interface SchemaConfigFnWithOptions extends AdapterSchemaConfigOptions {
|
|
644
|
+
(): ColumnSchemaConfig;
|
|
645
|
+
}
|
|
628
646
|
interface ColumnSchemaConfig<T extends Column.Pick.Data = Column.Pick.Data> extends ColumnTypeSchemaArg {
|
|
647
|
+
intervalParse?(input: unknown): PostgresInterval;
|
|
629
648
|
dateAsNumber: unknown;
|
|
630
649
|
dateAsDate: unknown;
|
|
631
650
|
enum: unknown;
|
|
@@ -1110,21 +1129,22 @@ declare class BigSerialColumn<Schema extends ColumnSchemaConfig> extends NumberA
|
|
|
1110
1129
|
toSQL(): string;
|
|
1111
1130
|
toCode(ctx: ColumnToCodeCtx, key: string): Code;
|
|
1112
1131
|
}
|
|
1113
|
-
interface TimeInterval {
|
|
1114
|
-
years?: number;
|
|
1115
|
-
months?: number;
|
|
1116
|
-
days?: number;
|
|
1117
|
-
hours?: number;
|
|
1118
|
-
minutes?: number;
|
|
1119
|
-
seconds?: number;
|
|
1120
|
-
}
|
|
1121
1132
|
type DateColumnInput = string | number | Date;
|
|
1133
|
+
declare const getDateAsNumberFn: (column: {
|
|
1134
|
+
data: Column.Data;
|
|
1135
|
+
dateParsedByDriver?: boolean;
|
|
1136
|
+
}) => (value: unknown) => number;
|
|
1137
|
+
declare const getDateAsDateFn: (column: {
|
|
1138
|
+
data: Column.Data;
|
|
1139
|
+
dateParsedByDriver?: boolean;
|
|
1140
|
+
}) => (value: unknown) => Date;
|
|
1122
1141
|
declare abstract class DateBaseColumn<Schema extends ColumnSchemaConfig> extends Column<Schema, string, ReturnType<Schema['stringNumberDate']>, OperatorsDate, DateColumnInput, string, ReturnType<Schema['stringSchema']>> {
|
|
1142
|
+
dateParsedByDriver?: boolean | undefined;
|
|
1123
1143
|
data: DateColumnData;
|
|
1124
1144
|
operators: OperatorsDate;
|
|
1125
1145
|
asNumber: Schema['dateAsNumber'];
|
|
1126
1146
|
asDate: Schema['dateAsDate'];
|
|
1127
|
-
constructor(schema: Schema);
|
|
1147
|
+
constructor(schema: Schema, dateParsedByDriver?: boolean | undefined);
|
|
1128
1148
|
}
|
|
1129
1149
|
declare class DateColumn<Schema extends ColumnSchemaConfig> extends DateBaseColumn<Schema> {
|
|
1130
1150
|
dataType: "date";
|
|
@@ -1134,7 +1154,7 @@ declare abstract class DateTimeBaseClass<Schema extends ColumnSchemaConfig> exte
|
|
|
1134
1154
|
data: DateColumnData & {
|
|
1135
1155
|
dateTimePrecision?: number;
|
|
1136
1156
|
};
|
|
1137
|
-
constructor(schema: Schema, dateTimePrecision?: number);
|
|
1157
|
+
constructor(schema: Schema, dateTimePrecision?: number, dateParsedByDriver?: boolean);
|
|
1138
1158
|
toSQL(): string;
|
|
1139
1159
|
}
|
|
1140
1160
|
declare abstract class DateTimeTzBaseClass<Schema extends ColumnSchemaConfig> extends DateTimeBaseClass<Schema> {
|
|
@@ -1159,14 +1179,14 @@ declare class TimeColumn<Schema extends ColumnSchemaConfig> extends Column<Schem
|
|
|
1159
1179
|
constructor(schema: Schema, dateTimePrecision?: number);
|
|
1160
1180
|
toCode(ctx: ColumnToCodeCtx, key: string): Code;
|
|
1161
1181
|
}
|
|
1162
|
-
declare class IntervalColumn<Schema extends ColumnSchemaConfig> extends Column<Schema,
|
|
1182
|
+
declare class IntervalColumn<Schema extends ColumnSchemaConfig> extends Column<Schema, PostgresInterval, ReturnType<Schema['timeInterval']>, OperatorsDate, Partial<PostgresInterval>, PostgresInterval> {
|
|
1163
1183
|
data: Column.Data & {
|
|
1164
1184
|
fields?: string;
|
|
1165
1185
|
precision?: number;
|
|
1166
1186
|
};
|
|
1167
1187
|
dataType: "interval";
|
|
1168
1188
|
operators: OperatorsDate;
|
|
1169
|
-
constructor(schema: Schema, fields?: string, precision?: number);
|
|
1189
|
+
constructor(schema: Schema, fields?: string, precision?: number, parse?: (input: string) => PostgresInterval);
|
|
1170
1190
|
toCode(ctx: ColumnToCodeCtx, key: string): Code;
|
|
1171
1191
|
toSQL(): string;
|
|
1172
1192
|
}
|
|
@@ -1199,17 +1219,17 @@ declare class ArrayColumn<Schema extends ColumnTypeSchemaArg, Item extends Array
|
|
|
1199
1219
|
dataType: "array";
|
|
1200
1220
|
operators: OperatorsArray<Item["queryType"]>;
|
|
1201
1221
|
data: ArrayData<Item>;
|
|
1202
|
-
constructor(schema: Schema, item: Item, inputType: InputType, outputType?: OutputType, queryType?: QueryType);
|
|
1222
|
+
constructor(schema: Schema, item: Item, inputType: InputType, defaultEncode?: (input: unknown) => unknown, outputType?: OutputType, queryType?: QueryType);
|
|
1203
1223
|
toSQL(): string;
|
|
1204
1224
|
toCode(this: ArrayColumn<ColumnSchemaConfig, ArrayColumnValue, unknown, unknown, unknown>, ctx: ColumnToCodeCtx, key: string): Code;
|
|
1205
1225
|
}
|
|
1206
1226
|
declare class JSONColumn<T, Schema extends ColumnTypeSchemaArg, InputSchema = Schema['type']> extends Column<Schema, T, InputSchema, OperatorsJson> {
|
|
1207
1227
|
dataType: "jsonb";
|
|
1208
1228
|
operators: OperatorsJson;
|
|
1209
|
-
constructor(schema: Schema, inputType: Schema['type']);
|
|
1229
|
+
constructor(schema: Schema, inputType: Schema['type'], encodedByDriver?: boolean);
|
|
1210
1230
|
toCode(ctx: ColumnToCodeCtx, key: string): Code;
|
|
1211
1231
|
}
|
|
1212
|
-
declare class JSONTextColumn<Schema extends ColumnSchemaConfig> extends Column<Schema,
|
|
1232
|
+
declare class JSONTextColumn<Schema extends ColumnSchemaConfig> extends Column<Schema, unknown, ReturnType<Schema['unknown']>, OperatorsText> {
|
|
1213
1233
|
dataType: "json";
|
|
1214
1234
|
operators: OperatorsText;
|
|
1215
1235
|
private static _instance;
|
|
@@ -1279,7 +1299,8 @@ interface DefaultSchemaConfig extends ColumnSchemaConfig<Column> {
|
|
|
1279
1299
|
timestampNoTZ(precision?: number): TimestampColumn<DefaultSchemaConfig>;
|
|
1280
1300
|
timestamp(precision?: number): TimestampTZColumn<DefaultSchemaConfig>;
|
|
1281
1301
|
}
|
|
1282
|
-
declare const defaultSchemaConfig: DefaultSchemaConfig;
|
|
1302
|
+
declare const defaultSchemaConfig: (options?: AdapterSchemaConfigOptions) => DefaultSchemaConfig;
|
|
1303
|
+
declare const internalSchemaConfig: DefaultSchemaConfig;
|
|
1283
1304
|
type TextColumnData = StringData;
|
|
1284
1305
|
declare abstract class TextBaseColumn<Schema extends ColumnSchemaConfig, Ops = OperatorsText> extends Column<Schema, string, ReturnType<Schema['stringSchema']>, Ops> {
|
|
1285
1306
|
data: TextColumnData;
|
|
@@ -2675,11 +2696,172 @@ interface AggregateOptions<T extends PickQuerySelectableResultRelationsWindows>
|
|
|
2675
2696
|
over?: Over<T>;
|
|
2676
2697
|
}
|
|
2677
2698
|
type Over<T extends PickQuerySelectableResultWindows> = keyof T['windows'] | WindowArgDeclaration<T>;
|
|
2678
|
-
|
|
2679
|
-
|
|
2699
|
+
interface ColumnsShape {
|
|
2700
|
+
[K: string]: Column;
|
|
2701
|
+
}
|
|
2702
|
+
declare namespace ColumnsShape {
|
|
2703
|
+
export type DefaultSelectKeys<S extends Column.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof S];
|
|
2704
|
+
export type DefaultOutput<Set extends Column.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['outputType'] };
|
|
2705
|
+
export type Input<Shape extends Column.QueryColumnsInit, AppReadOnly = { [K in keyof Shape]: Shape[K]['data']['appReadOnly'] extends true ? K : never }[keyof Shape], Optional extends keyof Shape = { [K in keyof Shape]: Shape[K]['data']['optional'] extends true ? K : never }[keyof Shape]> = { [K in Exclude<keyof Shape, AppReadOnly | Optional>]: Shape[K]['inputType'] } & { [K in Exclude<Optional, AppReadOnly>]?: Shape[K]['inputType'] };
|
|
2706
|
+
export type InputPartial<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['inputType'] };
|
|
2707
|
+
export type Output<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['outputType'] };
|
|
2708
|
+
export type DefaultSelectOutput<Shape extends Column.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof Shape]]: Shape[K]['outputType'] };
|
|
2709
|
+
export interface MapToObjectColumn<Shape extends Column.QueryColumns> {
|
|
2710
|
+
dataType: 'object';
|
|
2711
|
+
type: { [K in keyof Shape]: Shape[K]['type'] };
|
|
2712
|
+
outputType: ShallowSimplify<ObjectOutput<Shape>>;
|
|
2713
|
+
queryType: { [K in keyof Shape]: Shape[K]['queryType'] };
|
|
2714
|
+
operators: OperatorsAny;
|
|
2715
|
+
}
|
|
2716
|
+
export interface MapToNullableObjectColumn<Shape extends Column.QueryColumns> {
|
|
2717
|
+
dataType: 'object';
|
|
2718
|
+
type: { [K in keyof Shape]: Shape[K]['type'] };
|
|
2719
|
+
outputType: ShallowSimplify<ObjectOutput<Shape>> | undefined;
|
|
2720
|
+
queryType: { [K in keyof Shape]: Shape[K]['queryType'] } | null;
|
|
2721
|
+
operators: OperatorsAny;
|
|
2722
|
+
}
|
|
2723
|
+
export interface MapToPluckColumn<Shape extends Column.QueryColumns> {
|
|
2724
|
+
dataType: 'array';
|
|
2725
|
+
type: Shape['pluck']['type'][];
|
|
2726
|
+
outputType: Shape['pluck']['outputType'][];
|
|
2727
|
+
queryType: Shape['pluck']['queryType'][];
|
|
2728
|
+
operators: OperatorsAny;
|
|
2729
|
+
}
|
|
2730
|
+
export interface MapToObjectArrayColumn<Shape extends Column.QueryColumns> {
|
|
2731
|
+
dataType: 'array';
|
|
2732
|
+
type: { [K in keyof Shape]: Shape[K]['type'] }[];
|
|
2733
|
+
outputType: ShallowSimplify<ObjectOutput<Shape>>[];
|
|
2734
|
+
queryType: { [K in keyof Shape]: Shape[K]['queryType'] }[];
|
|
2735
|
+
operators: OperatorsAny;
|
|
2736
|
+
}
|
|
2737
|
+
type ObjectOutput<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['outputType'] };
|
|
2738
|
+
export {};
|
|
2739
|
+
}
|
|
2740
|
+
interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape, PickQueryRelations, PickQueryResult, PickQueryReturnType, PickQueryWithData {}
|
|
2741
|
+
type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
|
|
2742
|
+
interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
|
|
2743
|
+
withData: T['withData'];
|
|
2744
|
+
}
|
|
2745
|
+
type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject extends T['relations'] ? T : { [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 };
|
|
2746
|
+
interface SelectAsArg<T extends SelectSelf> {
|
|
2747
|
+
[K: string]: keyof T['__selectable'] | Expression | ((q: SelectAsFnArg<T>) => unknown);
|
|
2748
|
+
}
|
|
2749
|
+
type SelectAsFnReturnType = {
|
|
2750
|
+
result: Column.QueryColumns;
|
|
2751
|
+
returnType: Exclude<QueryReturnType, 'rows'>;
|
|
2752
|
+
} | Expression;
|
|
2753
|
+
interface SelectAsCheckReturnTypes {
|
|
2754
|
+
[K: string]: PropertyKey | Expression | ((q: never) => SelectAsFnReturnType);
|
|
2755
|
+
}
|
|
2756
|
+
type SelectReturnType<T extends PickQueryReturnType> = T['returnType'] extends 'valueOrThrow' ? 'oneOrThrow' : T extends 'value' ? 'one' : T['returnType'] extends 'pluck' ? 'all' : T['returnType'];
|
|
2757
|
+
type SelectResult<T extends SelectSelf, Columns extends PropertyKey[]> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (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>, { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
2758
|
+
type SelectResultObj<T extends SelectSelf, Obj> = Obj extends SelectAsCheckReturnTypes ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? { [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 } : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [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 }> : T[K] } : `Invalid return type of ${{ [K in keyof Obj]: Obj[K] extends ((...args: any[]) => any) ? ReturnType<Obj[K]> extends SelectAsFnReturnType ? never : K : never }[keyof Obj] & string}`;
|
|
2759
|
+
type SelectResultColumnsAndObj<T extends SelectSelf, Columns extends PropertyKey[], Obj> = { [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,
|
|
2760
|
+
{ [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'] } & (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>, { [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'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
2761
|
+
interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
|
|
2762
|
+
result: Column.QueryColumns;
|
|
2763
|
+
returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
|
|
2764
|
+
}
|
|
2765
|
+
type SelectAsSelectable<Obj> = UnionToIntersection<{ [K in keyof Obj]: Obj[K] extends ((q: never) => infer R extends AllowedRelationOneQueryForSelectable) ? { [C in R['returnType'] extends 'value' | 'valueOrThrow' ? K : keyof R['result'] as R['returnType'] extends 'value' | 'valueOrThrow' ? K : `${K & string}.${C & string}`]: {
|
|
2766
|
+
as: C;
|
|
2767
|
+
column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
|
|
2768
|
+
} } : never }[keyof Obj]>;
|
|
2769
|
+
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;
|
|
2770
|
+
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']>;
|
|
2771
|
+
declare function _querySelect<T extends SelectSelf, Columns extends SelectArgs<T>>(q: T, columns: Columns): SelectResult<T, Columns>;
|
|
2772
|
+
declare function _querySelect<T extends SelectSelf, Obj extends SelectAsArg<T>>(q: T, obj: Obj): SelectResultObj<T, Obj>;
|
|
2773
|
+
declare function _querySelect<T extends SelectSelf, Columns extends SelectArgs<T>, Obj extends SelectAsArg<T>>(q: T, args: [...columns: Columns, obj: Obj]): SelectResultColumnsAndObj<T, Columns, Obj>;
|
|
2774
|
+
declare class Select {
|
|
2775
|
+
/**
|
|
2776
|
+
* Takes a list of columns to be selected, and by default, the query builder will select all columns of the table.
|
|
2777
|
+
*
|
|
2778
|
+
* The last argument can be an object. Keys of the object are column aliases, value can be a column name, sub-query, or raw SQL expression.
|
|
2779
|
+
*
|
|
2780
|
+
* ```ts
|
|
2781
|
+
* import { sql } from './baseTable'
|
|
2782
|
+
*
|
|
2783
|
+
* // select columns of the table:
|
|
2784
|
+
* db.table.select('id', 'name', { idAlias: 'id' });
|
|
2785
|
+
*
|
|
2786
|
+
* // accepts columns with table names:
|
|
2787
|
+
* db.table.select('user.id', 'user.name', { nameAlias: 'user.name' });
|
|
2788
|
+
*
|
|
2789
|
+
* // table name may refer to the current table or a joined table:
|
|
2790
|
+
* db.table
|
|
2791
|
+
* .join(db.message, 'authorId', 'user.id')
|
|
2792
|
+
* .select('user.name', 'message.text', { textAlias: 'message.text' });
|
|
2793
|
+
*
|
|
2794
|
+
* // select value from the sub-query,
|
|
2795
|
+
* // this sub-query should return a single record and a single column:
|
|
2796
|
+
* db.table.select({
|
|
2797
|
+
* subQueryResult: Otherdb.table.select('column').take(),
|
|
2798
|
+
* });
|
|
2799
|
+
*
|
|
2800
|
+
* // select raw SQL value, specify the returning type via <generic> syntax:
|
|
2801
|
+
* db.table.select({
|
|
2802
|
+
* raw: sql<number>`1 + 2`,
|
|
2803
|
+
* });
|
|
2804
|
+
*
|
|
2805
|
+
* // select raw SQL value, the resulting type can be set by providing a column type in such way:
|
|
2806
|
+
* db.table.select({
|
|
2807
|
+
* raw: sql`1 + 2`.type((t) => t.integer()),
|
|
2808
|
+
* });
|
|
2809
|
+
*
|
|
2810
|
+
* // same raw SQL query as above, but the sql is returned from a callback
|
|
2811
|
+
* db.table.select({
|
|
2812
|
+
* raw: () => sql`1 + 2`.type((t) => t.integer()),
|
|
2813
|
+
* });
|
|
2814
|
+
* ```
|
|
2815
|
+
*
|
|
2816
|
+
* When you use the ORM and defined relations, `select` can also accept callbacks with related table queries:
|
|
2817
|
+
*
|
|
2818
|
+
* ```ts
|
|
2819
|
+
* await db.author.select({
|
|
2820
|
+
* allBooks: (q) => q.books,
|
|
2821
|
+
* firstBook: (q) => q.books.order({ createdAt: 'ASC' }).take(),
|
|
2822
|
+
* booksCount: (q) => q.books.count(),
|
|
2823
|
+
* });
|
|
2824
|
+
* ```
|
|
2825
|
+
*
|
|
2826
|
+
* When you're selecting a relation that's connected via `belongsTo` or `hasOne`, it becomes available to use in `order` or in `where`:
|
|
2827
|
+
*
|
|
2828
|
+
* ```ts
|
|
2829
|
+
* // select books with their authors included, order by author name and filter by author column:
|
|
2830
|
+
* await db.books
|
|
2831
|
+
* .select({
|
|
2832
|
+
* author: (q) => q.author,
|
|
2833
|
+
* })
|
|
2834
|
+
* .order('author.name')
|
|
2835
|
+
* .where({ 'author.isPopular': true });
|
|
2836
|
+
* ```
|
|
2837
|
+
*/
|
|
2838
|
+
select<T extends SelectSelf, Columns extends SelectArgs<T>>(this: T, ...args: Columns): SelectResult<T, Columns>;
|
|
2839
|
+
select<T extends SelectSelf, Obj extends SelectAsArg<T>>(this: T, obj: Obj): SelectResultObj<T, Obj>;
|
|
2840
|
+
select<T extends SelectSelf, Columns extends SelectArgs<T>, Obj extends SelectAsArg<T>>(this: T, ...args: [...columns: Columns, obj: Obj]): SelectResultColumnsAndObj<T, Columns, Obj>;
|
|
2841
|
+
/**
|
|
2842
|
+
* When querying the table or creating records, all columns are selected by default,
|
|
2843
|
+
* but updating and deleting queries are returning affected row counts by default.
|
|
2844
|
+
*
|
|
2845
|
+
* Use `selectAll` to select all columns. If the `.select` method was applied before it will be discarded.
|
|
2846
|
+
*
|
|
2847
|
+
* ```ts
|
|
2848
|
+
* const selectFull = await db.table
|
|
2849
|
+
* .select('id', 'name') // discarded by `selectAll`
|
|
2850
|
+
* .selectAll();
|
|
2851
|
+
*
|
|
2852
|
+
* const updatedFull = await db.table.selectAll().where(conditions).update(data);
|
|
2853
|
+
*
|
|
2854
|
+
* const deletedFull = await db.table.selectAll().where(conditions).delete();
|
|
2855
|
+
* ```
|
|
2856
|
+
*/
|
|
2857
|
+
selectAll<T extends SelectSelf>(this: T): SelectResult<T, ['*']>;
|
|
2858
|
+
}
|
|
2859
|
+
interface QueryGetSelf extends PickQuerySelectable, PickQueryRelationsWithData {}
|
|
2860
|
+
type GetArg<T extends QueryGetSelf> = GetStringArg<T> | Expression | ((q: SelectAsFnArg<T>) => Expression | Query.Pick.SingleValueResult);
|
|
2680
2861
|
type GetStringArg<T extends PickQuerySelectable> = keyof T['__selectable'] & string;
|
|
2681
|
-
type
|
|
2682
|
-
type
|
|
2862
|
+
type ResolveGetArgColumn<Arg> = Arg extends Expression ? Arg['result']['value'] : Arg extends ((q: never) => infer R) ? R extends Expression ? R['result']['value'] : R extends Query.Pick.SingleValueResult ? R['result']['value'] : never : never;
|
|
2863
|
+
type GetResult<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOrThrow<T, Arg> : SetQueryReturnsColumnOrThrow<T, ResolveGetArgColumn<Arg>>;
|
|
2864
|
+
type GetResultOptional<T extends QueryGetSelf, Arg extends GetArg<T>> = Arg extends string ? SetQueryReturnsValueOptional<T, Arg> : SetQueryReturnsColumnOptional<T, ResolveGetArgColumn<Arg>>;
|
|
2683
2865
|
type HeadlineSearchArg<T extends PickQueryTsQuery> = Exclude<T['__tsQuery'], undefined>;
|
|
2684
2866
|
interface HeadlineParams<T extends PickQuerySelectable> {
|
|
2685
2867
|
text?: SelectableOrExpressionOfType<T, Column.Pick.QueryColumnOfType<string>>;
|
|
@@ -4694,7 +4876,7 @@ interface DbSharedOptions extends QueryLogOptions {
|
|
|
4694
4876
|
grants?: Grant.Privilege[];
|
|
4695
4877
|
}
|
|
4696
4878
|
interface DbOptions<SchemaConfig extends ColumnSchemaConfig, ColumnTypes> extends DbSharedOptions {
|
|
4697
|
-
schemaConfig?: SchemaConfig;
|
|
4879
|
+
schemaConfig?: () => SchemaConfig;
|
|
4698
4880
|
columnTypes?: ColumnTypes | ((t: DefaultColumnTypes<SchemaConfig>) => ColumnTypes);
|
|
4699
4881
|
snakeCase?: boolean;
|
|
4700
4882
|
nowSQL?: string;
|
|
@@ -4835,7 +5017,7 @@ declare class Db<Table extends string | undefined = undefined, Shape extends Col
|
|
|
4835
5017
|
*
|
|
4836
5018
|
* @param args - SQL template literal, or a raw SQL object created by `raw()` or `sql()` function
|
|
4837
5019
|
*/
|
|
4838
|
-
queryArrays<R extends any[] = any[]>(...args: SQLQueryArgs): Promise<
|
|
5020
|
+
queryArrays<R extends any[] = any[]>(...args: SQLQueryArgs): Promise<QueryResult<R>>;
|
|
4839
5021
|
}
|
|
4840
5022
|
interface DbTableConstructor<ColumnTypes> {
|
|
4841
5023
|
<Table extends string, Shape extends Column.QueryColumnsInit, Data extends MaybeArray<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>> & {
|
|
@@ -4943,8 +5125,8 @@ declare const createDbWithAdapter: <SchemaConfig extends ColumnSchemaConfig = De
|
|
|
4943
5125
|
log,
|
|
4944
5126
|
logger,
|
|
4945
5127
|
snakeCase,
|
|
4946
|
-
schemaConfig,
|
|
4947
|
-
columnTypes
|
|
5128
|
+
schemaConfig: schemaConfigFn,
|
|
5129
|
+
columnTypes,
|
|
4948
5130
|
schema,
|
|
4949
5131
|
...options
|
|
4950
5132
|
}: DbOptionsWithAdapter<SchemaConfig, ColumnTypes>) => DbResult<ColumnTypes>;
|
|
@@ -5906,166 +6088,6 @@ declare class QueryTransaction {
|
|
|
5906
6088
|
*/
|
|
5907
6089
|
recoverable<T>(this: T): T;
|
|
5908
6090
|
}
|
|
5909
|
-
interface ColumnsShape {
|
|
5910
|
-
[K: string]: Column;
|
|
5911
|
-
}
|
|
5912
|
-
declare namespace ColumnsShape {
|
|
5913
|
-
export type DefaultSelectKeys<S extends Column.QueryColumnsInit> = { [K in keyof S]: S[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof S];
|
|
5914
|
-
export type DefaultOutput<Set extends Column.QueryColumnsInit> = { [K in DefaultSelectKeys<Set>]: Set[K]['outputType'] };
|
|
5915
|
-
export type Input<Shape extends Column.QueryColumnsInit, AppReadOnly = { [K in keyof Shape]: Shape[K]['data']['appReadOnly'] extends true ? K : never }[keyof Shape], Optional extends keyof Shape = { [K in keyof Shape]: Shape[K]['data']['optional'] extends true ? K : never }[keyof Shape]> = { [K in Exclude<keyof Shape, AppReadOnly | Optional>]: Shape[K]['inputType'] } & { [K in Exclude<Optional, AppReadOnly>]?: Shape[K]['inputType'] };
|
|
5916
|
-
export type InputPartial<Shape extends Column.QueryColumnsInit> = { [K in keyof Shape]?: Shape[K]['inputType'] };
|
|
5917
|
-
export type Output<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['outputType'] };
|
|
5918
|
-
export type DefaultSelectOutput<Shape extends Column.QueryColumnsInit> = { [K in { [K in keyof Shape]: Shape[K]['data']['explicitSelect'] extends true | undefined ? never : K }[keyof Shape]]: Shape[K]['outputType'] };
|
|
5919
|
-
export interface MapToObjectColumn<Shape extends Column.QueryColumns> {
|
|
5920
|
-
dataType: 'object';
|
|
5921
|
-
type: { [K in keyof Shape]: Shape[K]['type'] };
|
|
5922
|
-
outputType: ShallowSimplify<ObjectOutput<Shape>>;
|
|
5923
|
-
queryType: { [K in keyof Shape]: Shape[K]['queryType'] };
|
|
5924
|
-
operators: OperatorsAny;
|
|
5925
|
-
}
|
|
5926
|
-
export interface MapToNullableObjectColumn<Shape extends Column.QueryColumns> {
|
|
5927
|
-
dataType: 'object';
|
|
5928
|
-
type: { [K in keyof Shape]: Shape[K]['type'] };
|
|
5929
|
-
outputType: ShallowSimplify<ObjectOutput<Shape>> | undefined;
|
|
5930
|
-
queryType: { [K in keyof Shape]: Shape[K]['queryType'] } | null;
|
|
5931
|
-
operators: OperatorsAny;
|
|
5932
|
-
}
|
|
5933
|
-
export interface MapToPluckColumn<Shape extends Column.QueryColumns> {
|
|
5934
|
-
dataType: 'array';
|
|
5935
|
-
type: Shape['pluck']['type'][];
|
|
5936
|
-
outputType: Shape['pluck']['outputType'][];
|
|
5937
|
-
queryType: Shape['pluck']['queryType'][];
|
|
5938
|
-
operators: OperatorsAny;
|
|
5939
|
-
}
|
|
5940
|
-
export interface MapToObjectArrayColumn<Shape extends Column.QueryColumns> {
|
|
5941
|
-
dataType: 'array';
|
|
5942
|
-
type: { [K in keyof Shape]: Shape[K]['type'] }[];
|
|
5943
|
-
outputType: ShallowSimplify<ObjectOutput<Shape>>[];
|
|
5944
|
-
queryType: { [K in keyof Shape]: Shape[K]['queryType'] }[];
|
|
5945
|
-
operators: OperatorsAny;
|
|
5946
|
-
}
|
|
5947
|
-
type ObjectOutput<Shape extends Column.QueryColumns> = { [K in keyof Shape]: Shape[K]['outputType'] };
|
|
5948
|
-
export {};
|
|
5949
|
-
}
|
|
5950
|
-
interface SelectSelf extends PickQuerySelectable, PickQueryHasSelect, PickQueryDefaultSelect, PickQueryShape, PickQueryRelations, PickQueryResult, PickQueryReturnType, PickQueryWithData {}
|
|
5951
|
-
type SelectArgs<T extends SelectSelf> = ('*' | keyof T['__selectable'])[];
|
|
5952
|
-
interface SubQueryAddition<T extends PickQueryWithData> extends IsSubQuery {
|
|
5953
|
-
withData: T['withData'];
|
|
5954
|
-
}
|
|
5955
|
-
type SelectAsFnArg<T extends PickQueryRelationsWithData> = EmptyObject extends T['relations'] ? T : { [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 };
|
|
5956
|
-
interface SelectAsArg<T extends SelectSelf> {
|
|
5957
|
-
[K: string]: keyof T['__selectable'] | Expression | ((q: SelectAsFnArg<T>) => unknown);
|
|
5958
|
-
}
|
|
5959
|
-
type SelectAsFnReturnType = {
|
|
5960
|
-
result: Column.QueryColumns;
|
|
5961
|
-
returnType: Exclude<QueryReturnType, 'rows'>;
|
|
5962
|
-
} | Expression;
|
|
5963
|
-
interface SelectAsCheckReturnTypes {
|
|
5964
|
-
[K: string]: PropertyKey | Expression | ((q: never) => SelectAsFnReturnType);
|
|
5965
|
-
}
|
|
5966
|
-
type SelectReturnType<T extends PickQueryReturnType> = T['returnType'] extends 'valueOrThrow' ? 'oneOrThrow' : T extends 'value' ? 'one' : T['returnType'] extends 'pluck' ? 'all' : T['returnType'];
|
|
5967
|
-
type SelectResult<T extends SelectSelf, Columns extends PropertyKey[]> = { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (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>, { [K in '*' extends Columns[number] ? Exclude<Columns[number], '*'> | T['__defaultSelect'] : Columns[number] as T['__selectable'][K]['as']]: T['__selectable'][K]['column'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
5968
|
-
type SelectResultObj<T extends SelectSelf, Obj> = Obj extends SelectAsCheckReturnTypes ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends '__selectable' ? T['__selectable'] & SelectAsSelectable<Obj> : K extends 'result' ? { [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 } : K extends 'returnType' ? SelectReturnType<T> : K extends 'then' ? QueryThenByReturnType<SelectReturnType<T>, { [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 }> : T[K] } : `Invalid return type of ${{ [K in keyof Obj]: Obj[K] extends ((...args: any[]) => any) ? ReturnType<Obj[K]> extends SelectAsFnReturnType ? never : K : never }[keyof Obj] & string}`;
|
|
5969
|
-
type SelectResultColumnsAndObj<T extends SelectSelf, Columns extends PropertyKey[], Obj> = { [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,
|
|
5970
|
-
{ [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'] } & (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>, { [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'] } & (T['__hasSelect'] extends (T['returnType'] extends 'value' | 'valueOrThrow' ? never : true) ? Omit<T['result'], Columns[number]> : unknown)> : T[K] };
|
|
5971
|
-
interface AllowedRelationOneQueryForSelectable extends IsSubQuery {
|
|
5972
|
-
result: Column.QueryColumns;
|
|
5973
|
-
returnType: 'value' | 'valueOrThrow' | 'one' | 'oneOrThrow';
|
|
5974
|
-
}
|
|
5975
|
-
type SelectAsSelectable<Obj> = UnionToIntersection<{ [K in keyof Obj]: Obj[K] extends ((q: never) => infer R extends AllowedRelationOneQueryForSelectable) ? { [C in R['returnType'] extends 'value' | 'valueOrThrow' ? K : keyof R['result'] as R['returnType'] extends 'value' | 'valueOrThrow' ? K : `${K & string}.${C & string}`]: {
|
|
5976
|
-
as: C;
|
|
5977
|
-
column: R['returnType'] extends 'value' | 'valueOrThrow' ? R['result']['value'] : R['result'][C & keyof R['result']];
|
|
5978
|
-
} } : never }[keyof Obj]>;
|
|
5979
|
-
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;
|
|
5980
|
-
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']>;
|
|
5981
|
-
declare function _querySelect<T extends SelectSelf, Columns extends SelectArgs<T>>(q: T, columns: Columns): SelectResult<T, Columns>;
|
|
5982
|
-
declare function _querySelect<T extends SelectSelf, Obj extends SelectAsArg<T>>(q: T, obj: Obj): SelectResultObj<T, Obj>;
|
|
5983
|
-
declare function _querySelect<T extends SelectSelf, Columns extends SelectArgs<T>, Obj extends SelectAsArg<T>>(q: T, args: [...columns: Columns, obj: Obj]): SelectResultColumnsAndObj<T, Columns, Obj>;
|
|
5984
|
-
declare class Select {
|
|
5985
|
-
/**
|
|
5986
|
-
* Takes a list of columns to be selected, and by default, the query builder will select all columns of the table.
|
|
5987
|
-
*
|
|
5988
|
-
* The last argument can be an object. Keys of the object are column aliases, value can be a column name, sub-query, or raw SQL expression.
|
|
5989
|
-
*
|
|
5990
|
-
* ```ts
|
|
5991
|
-
* import { sql } from './baseTable'
|
|
5992
|
-
*
|
|
5993
|
-
* // select columns of the table:
|
|
5994
|
-
* db.table.select('id', 'name', { idAlias: 'id' });
|
|
5995
|
-
*
|
|
5996
|
-
* // accepts columns with table names:
|
|
5997
|
-
* db.table.select('user.id', 'user.name', { nameAlias: 'user.name' });
|
|
5998
|
-
*
|
|
5999
|
-
* // table name may refer to the current table or a joined table:
|
|
6000
|
-
* db.table
|
|
6001
|
-
* .join(db.message, 'authorId', 'user.id')
|
|
6002
|
-
* .select('user.name', 'message.text', { textAlias: 'message.text' });
|
|
6003
|
-
*
|
|
6004
|
-
* // select value from the sub-query,
|
|
6005
|
-
* // this sub-query should return a single record and a single column:
|
|
6006
|
-
* db.table.select({
|
|
6007
|
-
* subQueryResult: Otherdb.table.select('column').take(),
|
|
6008
|
-
* });
|
|
6009
|
-
*
|
|
6010
|
-
* // select raw SQL value, specify the returning type via <generic> syntax:
|
|
6011
|
-
* db.table.select({
|
|
6012
|
-
* raw: sql<number>`1 + 2`,
|
|
6013
|
-
* });
|
|
6014
|
-
*
|
|
6015
|
-
* // select raw SQL value, the resulting type can be set by providing a column type in such way:
|
|
6016
|
-
* db.table.select({
|
|
6017
|
-
* raw: sql`1 + 2`.type((t) => t.integer()),
|
|
6018
|
-
* });
|
|
6019
|
-
*
|
|
6020
|
-
* // same raw SQL query as above, but the sql is returned from a callback
|
|
6021
|
-
* db.table.select({
|
|
6022
|
-
* raw: () => sql`1 + 2`.type((t) => t.integer()),
|
|
6023
|
-
* });
|
|
6024
|
-
* ```
|
|
6025
|
-
*
|
|
6026
|
-
* When you use the ORM and defined relations, `select` can also accept callbacks with related table queries:
|
|
6027
|
-
*
|
|
6028
|
-
* ```ts
|
|
6029
|
-
* await db.author.select({
|
|
6030
|
-
* allBooks: (q) => q.books,
|
|
6031
|
-
* firstBook: (q) => q.books.order({ createdAt: 'ASC' }).take(),
|
|
6032
|
-
* booksCount: (q) => q.books.count(),
|
|
6033
|
-
* });
|
|
6034
|
-
* ```
|
|
6035
|
-
*
|
|
6036
|
-
* When you're selecting a relation that's connected via `belongsTo` or `hasOne`, it becomes available to use in `order` or in `where`:
|
|
6037
|
-
*
|
|
6038
|
-
* ```ts
|
|
6039
|
-
* // select books with their authors included, order by author name and filter by author column:
|
|
6040
|
-
* await db.books
|
|
6041
|
-
* .select({
|
|
6042
|
-
* author: (q) => q.author,
|
|
6043
|
-
* })
|
|
6044
|
-
* .order('author.name')
|
|
6045
|
-
* .where({ 'author.isPopular': true });
|
|
6046
|
-
* ```
|
|
6047
|
-
*/
|
|
6048
|
-
select<T extends SelectSelf, Columns extends SelectArgs<T>>(this: T, ...args: Columns): SelectResult<T, Columns>;
|
|
6049
|
-
select<T extends SelectSelf, Obj extends SelectAsArg<T>>(this: T, obj: Obj): SelectResultObj<T, Obj>;
|
|
6050
|
-
select<T extends SelectSelf, Columns extends SelectArgs<T>, Obj extends SelectAsArg<T>>(this: T, ...args: [...columns: Columns, obj: Obj]): SelectResultColumnsAndObj<T, Columns, Obj>;
|
|
6051
|
-
/**
|
|
6052
|
-
* When querying the table or creating records, all columns are selected by default,
|
|
6053
|
-
* but updating and deleting queries are returning affected row counts by default.
|
|
6054
|
-
*
|
|
6055
|
-
* Use `selectAll` to select all columns. If the `.select` method was applied before it will be discarded.
|
|
6056
|
-
*
|
|
6057
|
-
* ```ts
|
|
6058
|
-
* const selectFull = await db.table
|
|
6059
|
-
* .select('id', 'name') // discarded by `selectAll`
|
|
6060
|
-
* .selectAll();
|
|
6061
|
-
*
|
|
6062
|
-
* const updatedFull = await db.table.selectAll().where(conditions).update(data);
|
|
6063
|
-
*
|
|
6064
|
-
* const deletedFull = await db.table.selectAll().where(conditions).delete();
|
|
6065
|
-
* ```
|
|
6066
|
-
*/
|
|
6067
|
-
selectAll<T extends SelectSelf>(this: T): SelectResult<T, ['*']>;
|
|
6068
|
-
}
|
|
6069
6091
|
type SelectItem = string | SelectAs | Expression | undefined;
|
|
6070
6092
|
interface SelectAs {
|
|
6071
6093
|
selectAs: SelectAsValue;
|
|
@@ -9069,7 +9091,7 @@ declare class CteQuery {
|
|
|
9069
9091
|
* two: t.string(),
|
|
9070
9092
|
* }),
|
|
9071
9093
|
* // define SQL expression:
|
|
9072
|
-
* (q) => sql`
|
|
9094
|
+
* (q) => sql`VALUES (1, 'two')`,
|
|
9073
9095
|
* )
|
|
9074
9096
|
* // is not prefixed in the middle of a query chain
|
|
9075
9097
|
* .withSql(
|
|
@@ -9077,7 +9099,7 @@ declare class CteQuery {
|
|
|
9077
9099
|
* (t) => ({
|
|
9078
9100
|
* x: t.integer(),
|
|
9079
9101
|
* }),
|
|
9080
|
-
* (q) => sql`
|
|
9102
|
+
* (q) => sql`VALUES (1)`,
|
|
9081
9103
|
* )
|
|
9082
9104
|
* .from('alias');
|
|
9083
9105
|
* ```
|
|
@@ -9100,7 +9122,7 @@ declare class CteQuery {
|
|
|
9100
9122
|
* one: t.integer(),
|
|
9101
9123
|
* two: t.string(),
|
|
9102
9124
|
* }),
|
|
9103
|
-
* (q) => sql`
|
|
9125
|
+
* (q) => sql`VALUES (1, 'two')`,
|
|
9104
9126
|
* )
|
|
9105
9127
|
* .from('alias');
|
|
9106
9128
|
* ```
|
|
@@ -9460,6 +9482,23 @@ declare class QueryGet {
|
|
|
9460
9482
|
*/
|
|
9461
9483
|
getOptional<T extends QueryGetSelf, Arg extends GetArg<T>>(this: T, arg: Arg): GetResultOptional<T, Arg>;
|
|
9462
9484
|
}
|
|
9485
|
+
interface QueryPluckSelf extends PickQuerySelectable, PickQueryRelationsWithData {}
|
|
9486
|
+
type PluckArg<T extends QueryPluckSelf> = SelectableOrExpression<T> | ((q: SelectAsFnArg<T>) => Expression | Query.Pick.SingleValueResult);
|
|
9487
|
+
type PluckResult<T extends QueryPluckSelf, S extends PluckArg<T>> = S extends ((q: never) => infer R) ? R extends Expression ? SetQueryReturnsPluck<T, R> : R extends Query.Pick.SingleValueResult ? { [K in keyof T]: K extends '__hasSelect' ? true : K extends 'result' ? {
|
|
9488
|
+
pluck: R['result']['value'];
|
|
9489
|
+
} : K extends 'returnType' ? 'pluck' : K extends 'then' ? QueryThen<R['result']['value']['outputType'][]> : T[K] } : never : S extends SelectableOrExpression<T> ? SetQueryReturnsPluck<T, S> : never;
|
|
9490
|
+
declare class QueryPluck {
|
|
9491
|
+
/**
|
|
9492
|
+
* `.pluck` returns a single array of a single selected column values:
|
|
9493
|
+
*
|
|
9494
|
+
* ```ts
|
|
9495
|
+
* const ids = await db.table.select('id').pluck();
|
|
9496
|
+
* // ids are an array of all users' id like [1, 2, 3]
|
|
9497
|
+
* ```
|
|
9498
|
+
* @param select - column name or a raw SQL
|
|
9499
|
+
*/
|
|
9500
|
+
pluck<T extends QueryPluckSelf, S extends PluckArg<T>>(this: T, select: S): PluckResult<T, S>;
|
|
9501
|
+
}
|
|
9463
9502
|
interface MergeQueryArg extends PickQueryTable, PickQuerySelectable, PickQueryResult, PickQueryReturnType, PickQueryWithData, PickQueryWindows, PickQueryThen, PickQueryHasSelect, PickQueryHasWhere {}
|
|
9464
9503
|
type MergeQuery<T extends MergeQueryArg, Q extends MergeQueryArg> = { [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] };
|
|
9465
9504
|
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'];
|
|
@@ -9729,7 +9768,7 @@ interface NarrowPluckTypeResult<T extends PickQueryResultReturnType, Narrow> ext
|
|
|
9729
9768
|
}
|
|
9730
9769
|
type QueryIfResult<T extends PickQueryResultReturnType, R extends PickQueryResult> = { [K in keyof T]: K extends 'result' ? { [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] : Column.Modifiers.QueryColumnToOptional<R['result'][K]> } : K extends 'then' ? QueryIfResultThen<T, R> : T[K] };
|
|
9731
9770
|
type QueryIfResultThen<T extends PickQueryResultReturnType, R extends PickQueryResult> = T['returnType'] extends undefined | 'all' ? QueryThenShallowSimplifyArr<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['outputType'] | R['result'][K]['outputType'] : T['result'][K]['outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['outputType'] }> : T['returnType'] extends 'one' ? QueryThenShallowSimplifyOptional<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['outputType'] | R['result'][K]['outputType'] : T['result'][K]['outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['outputType'] }> : T['returnType'] extends 'oneOrThrow' ? QueryThenShallowSimplify<{ [K in keyof T['result']]: K extends keyof R['result'] ? T['result'][K]['outputType'] | R['result'][K]['outputType'] : T['result'][K]['outputType'] } & { [K in keyof R['result'] as K extends keyof T['result'] ? never : K]?: R['result'][K]['outputType'] }> : T['returnType'] extends 'value' ? QueryThen<T['result']['value']['outputType'] | R['result']['value']['outputType'] | undefined> : T['returnType'] extends 'valueOrThrow' ? QueryThen<T['result']['value']['outputType'] | R['result']['value']['outputType']> : T['returnType'] extends 'rows' ? QueryThen<(T['result'][keyof T['result']]['outputType'] | R['result'][keyof R['result']]['outputType'])[][]> : T['returnType'] extends 'pluck' ? QueryThen<(T['result']['pluck']['outputType'] | R['result']['pluck']['outputType'])[]> : QueryThen<void>;
|
|
9732
|
-
interface QueryMethods<ColumnTypes> extends QueryClone, QueryAsMethods, AggregateMethods, QueryDistinct, Select, FromMethods, QueryJoin, QueryLimitOffset, CteQuery, Union, QueryJsonMethods, QueryCreate, QueryCreateFrom, QueryUpdate, QueryDelete, QueryStorage, QueryTransaction, QueryTruncate, For, Where, SearchMethods, Clear, Having, QueryCatchers, QueryLog, QueryOrder, QueryWithSchema, QueryHooks, QueryUpsert, QueryOrCreate, QueryGet, MergeQueryMethods, QuerySql<ColumnTypes>, QueryTransform, QueryMap, QueryScope, SoftDeleteMethods, QueryExpressions, QueryWrap, QueryWindow {}
|
|
9771
|
+
interface QueryMethods<ColumnTypes> extends QueryClone, QueryAsMethods, AggregateMethods, QueryDistinct, Select, FromMethods, QueryJoin, QueryLimitOffset, CteQuery, Union, QueryJsonMethods, QueryCreate, QueryCreateFrom, QueryUpdate, QueryDelete, QueryStorage, QueryTransaction, QueryTruncate, For, Where, SearchMethods, Clear, Having, QueryCatchers, QueryLog, QueryOrder, QueryWithSchema, QueryHooks, QueryUpsert, QueryOrCreate, QueryGet, QueryPluck, MergeQueryMethods, QuerySql<ColumnTypes>, QueryTransform, QueryMap, QueryScope, SoftDeleteMethods, QueryExpressions, QueryWrap, QueryWindow {}
|
|
9733
9772
|
declare class QueryMethods<ColumnTypes> {
|
|
9734
9773
|
/**
|
|
9735
9774
|
* `.all` is a default behavior, that returns an array of objects:
|
|
@@ -9784,16 +9823,6 @@ declare class QueryMethods<ColumnTypes> {
|
|
|
9784
9823
|
* ```
|
|
9785
9824
|
*/
|
|
9786
9825
|
rows<T extends PickQueryResult>(this: T): SetQueryReturnsRows<T>;
|
|
9787
|
-
/**
|
|
9788
|
-
* `.pluck` returns a single array of a single selected column values:
|
|
9789
|
-
*
|
|
9790
|
-
* ```ts
|
|
9791
|
-
* const ids = await db.table.select('id').pluck();
|
|
9792
|
-
* // ids are an array of all users' id like [1, 2, 3]
|
|
9793
|
-
* ```
|
|
9794
|
-
* @param select - column name or a raw SQL
|
|
9795
|
-
*/
|
|
9796
|
-
pluck<T extends PickQuerySelectable, S extends SelectableOrExpression<T>>(this: T, select: S): SetQueryReturnsPluck<T, S>;
|
|
9797
9826
|
/**
|
|
9798
9827
|
* `.exec` won't parse the response at all, and returns undefined:
|
|
9799
9828
|
*
|
|
@@ -10258,6 +10287,14 @@ declare namespace Query {
|
|
|
10258
10287
|
type Arg<T extends Order.ArgThis> = Order.Arg<T>;
|
|
10259
10288
|
type Args<T extends Order.ArgThis> = Order.Args<T>;
|
|
10260
10289
|
}
|
|
10290
|
+
namespace Pick {
|
|
10291
|
+
interface SingleValueResult {
|
|
10292
|
+
result: {
|
|
10293
|
+
value: Column.Pick.OutputType;
|
|
10294
|
+
};
|
|
10295
|
+
returnType: 'value' | 'valueOrThrow';
|
|
10296
|
+
}
|
|
10297
|
+
}
|
|
10261
10298
|
}
|
|
10262
10299
|
type SelectableOfType<T extends PickQuerySelectable, Type> = { [K in keyof T['__selectable']]: T['__selectable'][K]['column']['type'] extends Type | null ? K : never }[keyof T['__selectable']];
|
|
10263
10300
|
type SelectableOrExpressionOfType<T extends PickQuerySelectable, C extends Column.Pick.Type> = SelectableOfType<T, C['type']> | Expression<Column.Pick.QueryColumnOfType<C['type'] | null>>;
|
|
@@ -10645,4 +10682,4 @@ declare const testTransaction: {
|
|
|
10645
10682
|
*/
|
|
10646
10683
|
close(arg: Arg$1): Promise<void>;
|
|
10647
10684
|
};
|
|
10648
|
-
export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinQueryMethod, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, Operators, type OperatorsArray, type OperatorsJson, type OperatorsOrdinalText, OrchidOrmInternalError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type Query, type QueryAfterHook, type
|
|
10685
|
+
export { type Adapter, AdapterClass, type AdapterConfigBase, type AdapterParams, type AdapterSchemaConfigOptions, type AfterCommitStandaloneHook, type AfterHook, ArrayColumn, type ArrayColumnValue, type ArrayData, type AsyncState, type BaseNumberData, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BoxColumn, ByteaColumn, CidrColumn, CircleColumn, CitextColumn, type Code, type Codes, Column, type ColumnFromDbParams, type ColumnSchemaConfig, type ColumnSchemaGetterColumns, type ColumnSchemaGetterTableClass, type ColumnToCodeCtx, type ColumnTypeSchemaArg, type ColumnsByType, type ColumnsShape, type ComputedColumnsFromOptions, type ComputedOptionsConfig, type ComputedOptionsFactory, type CreateCtx, type CreateData, type CreateManyMethodsNames, type CreateMethodsNames, type CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, type DateColumnData, DateTimeBaseClass, DateTimeTzBaseClass, Db, type DbDomainArg, type DbExtension, type DbOptions, type DbResult, type DbSharedOptions, type DbSqlMethod, type DbStructureDomainsMap, type DbTableOptionScopes, type DbTableOptions, DecimalColumn, type DecimalColumnData, type DefaultColumnTypes, type DefaultPrivileges, type DefaultSchemaConfig, type DeleteMethodsNames, DomainColumn, DoublePrecisionColumn, type DriverAdapter, DynamicRawSQL, type EmptyObject, type EmptyTuple, EnumColumn, Expression, type FromArg, type FromResult, type GeneratorIgnore, type Grant, type HookSelectValue, InetColumn, IntegerBaseColumn, IntegerColumn, IntervalColumn, type IsQuery, type IsolationLevel, JSONColumn, JSONTextColumn, type JoinQueryMethod, type JoinedShapes, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, type MapTableScopesOption, type MaybeArray, type MaybePromise, type MergeQuery, MoneyColumn, type NoPrimaryKeyOption, type NonUniqDataItem, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, type NumberColumnData, Operators, type OperatorsArray, type OperatorsJson, type OperatorsOrdinalText, OrchidOrmInternalError, type Ord, PathColumn, type PickQueryInputType, type PickQueryInternal, type PickQueryQ, type PickQueryRelations, type PickQuerySelectableRelations, type PickQueryShape, PointColumn, PolygonColumn, PostgisGeographyPointColumn, type Query, type QueryAfterHook, type QueryBeforeActionHook, type QueryBeforeHook, type QueryData, QueryError, type QueryHasWhere, type QueryHelperResult, QueryHookUtils, QueryHooks, type QueryInternal, type QueryLogObject, type QueryLogOptions, type QueryLogger, type QueryManyTake, type QueryManyTakeOptional, type QueryOrExpression, type QueryResult, type QueryResultRow, type QueryReturnType, type QuerySchema, type QueryScopes, RawSql, type RawSqlBase, RealColumn, type RecordKeyTrue, type RecordOptionalString, type RecordString, type RecordStringOrNumber, type RecordUnknown, type RelationConfigBase, type RelationJoinQuery, type RelationsBase, type Rls, type RlsPolicy, type SchemaConfigFnWithOptions, type SearchWeight, type SelectableFromShape, SerialColumn, type SerialColumnData, type ShallowSimplify, type ShapeColumnPrimaryKeys, type ShapeUniqueColumns, type SingleSql, type SingleSqlItem, SmallIntColumn, SmallSerialColumn, type Sql, type SqlFn, type SqlSessionState, type StorageOptions, StringColumn, type StringData, type TableData, type TableDataFn, type TableDataInput, type TableDataItem, type TableDataItemsUniqueColumnTuples, type TableDataItemsUniqueColumns, type TableDataItemsUniqueConstraints, type TableDataMethods, type TemplateLiteralArgs, TextBaseColumn, TextColumn, TimeColumn, TimestampColumn, TimestampTZColumn, type Timestamps, type TransactionAdapter, TransactionAdapterClass, type TransactionOptions, TsQueryColumn, TsVectorColumn, UUIDColumn, type UniqueConstraints, type UniqueTableDataItem, UnknownColumn, type UpdateData, type UpsertData, type UpsertThis, VarCharColumn, VirtualColumn, type WhereArg, XMLColumn, _appendQuery, _clone, _createDbSqlMethod, _hookSelectColumns, _initQueryBuilder, _orCreate, _prependWith, _queryCreate, _queryCreateMany, _queryCreateManyFrom, _queryDefaults, _queryDelete, _queryFindBy, _queryFindByOptional, _queryHookAfterCreate, _queryHookAfterUpdate, _queryInsert, _queryInsertMany, _queryJoinOn, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUpdate, _queryUpdateOrThrow, _queryUpsert, _queryWhere, _queryWhereExists, _queryWhereIn, addCode, addTopCte, addTopCteSql, applyMixins, assignDbDataToColumn, backtickQuote, cloneQueryBaseUnscoped, codeToString, colors, columnsShapeToCode, constraintInnerToCode, consumeColumnName, copyTableData, createDbWithAdapter, deepCompare, defaultSchemaConfig, emptyArray, emptyObject, escapeForMigration, escapeString, excludeInnerToCode, exhaustive, getCallerFilePath, getClonedQueryData, getColumnBaseType, getColumnInfo, getColumnTypes, getDateAsDateFn, getDateAsNumberFn, getDriverErrorCode, getFreeAlias, getFreeSetAlias, getImportPath, getPrimaryKeys, getQueryAs, getQuerySchema, getShapeFromSelect, getSqlText, getStackTrace, getSupportedDefaultPrivileges, indexInnerToCode, internalSchemaConfig, isExpression, isQueryReturnsAll, isRawSQL, logColors, logParamToLogObject, makeColumnNullable, makeColumnTypes, makeColumnsByType, makeConnectRetryConfig, noop, objectHasValues, omit, parseTableData, parseTableDataInput, pathToLog, pick, pluralize, prepareSubQueryForSql, primaryKeyInnerToCode, pushQueryOnForOuter, pushQueryValueImmutable, pushTableDataCode, quoteIdentifier, quoteObjectKey, quoteTableWithSchema, raw, rawSqlToCode, referencesArgsToCode, returnArg, setColumnData, setColumnEncode, setColumnParse, setColumnParseNull, setCurrentColumnName, setDataValue, setDefaultLanguage, setFreeAlias, setQueryObjectValueImmutable, singleQuote, tableDataMethods, testTransaction, toArray, toCamelCase, toPascalCase, toSnakeCase, wrapAdapterFnWithConnectRetry };
|