pqb 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +242 -226
- package/dist/index.js +711 -439
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +712 -440
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as orchid_core from 'orchid-core';
|
|
2
|
-
import { EmptyObject,
|
|
2
|
+
import { EmptyObject, RawExpression, ColumnTypeBase, MaybeArray, QueryResultRow, AdapterBase, QueryInput, ColumnsShapeBase, StringKey, ColumnOutput, SimpleSpread, FilterTuple, NullableColumn, QueryInternal, QueryMetaBase, ColumnTypesBase, DbBase, ThenResult, ColumnShapeOutput, DefaultSelectColumns, SetOptional, Spread, CoalesceString, QueryBaseCommon, QueryCommon, ColumnDataBase, BaseOperators, PrimaryKeyColumn, HiddenColumn, ValidationContext, BaseNumberData, Code, numberTypeMethods, BaseStringData, DateColumnData, dateTypeMethods, JSONTypeAny, record, arrayMethods, name } from 'orchid-core';
|
|
3
3
|
import { PoolConfig, Pool, PoolClient } from 'pg';
|
|
4
4
|
|
|
5
5
|
declare type BaseRelation = {
|
|
@@ -87,6 +87,168 @@ declare type RelationQuery<Name extends PropertyKey = string, Params extends Rec
|
|
|
87
87
|
[K in DeleteMethodsNames]: never;
|
|
88
88
|
})> = ((params: Params) => Q) & Q;
|
|
89
89
|
|
|
90
|
+
declare type Sql = {
|
|
91
|
+
text: string;
|
|
92
|
+
values: unknown[];
|
|
93
|
+
};
|
|
94
|
+
declare const checkIfASimpleQuery: (q: Query) => boolean;
|
|
95
|
+
declare type WithItem = [
|
|
96
|
+
as: string,
|
|
97
|
+
options: WithOptions,
|
|
98
|
+
query: Query | RawExpression
|
|
99
|
+
];
|
|
100
|
+
declare type WithOptions = {
|
|
101
|
+
columns?: string[];
|
|
102
|
+
recursive?: true;
|
|
103
|
+
materialized?: true;
|
|
104
|
+
notMaterialized?: true;
|
|
105
|
+
};
|
|
106
|
+
declare type JsonItem<As extends string = string, Type extends ColumnTypeBase = ColumnTypeBase> = {
|
|
107
|
+
__json: [
|
|
108
|
+
kind: 'set',
|
|
109
|
+
as: As,
|
|
110
|
+
type: Type,
|
|
111
|
+
column: string | JsonItem,
|
|
112
|
+
path: Array<string | number>,
|
|
113
|
+
value: unknown,
|
|
114
|
+
options?: {
|
|
115
|
+
createIfMissing?: boolean;
|
|
116
|
+
}
|
|
117
|
+
] | [
|
|
118
|
+
kind: 'insert',
|
|
119
|
+
as: As,
|
|
120
|
+
type: Type,
|
|
121
|
+
column: string | JsonItem,
|
|
122
|
+
path: Array<string | number>,
|
|
123
|
+
value: unknown,
|
|
124
|
+
options?: {
|
|
125
|
+
insertAfter?: boolean;
|
|
126
|
+
}
|
|
127
|
+
] | [
|
|
128
|
+
kind: 'remove',
|
|
129
|
+
as: As,
|
|
130
|
+
type: Type,
|
|
131
|
+
column: string | JsonItem,
|
|
132
|
+
path: Array<string | number>
|
|
133
|
+
] | [
|
|
134
|
+
kind: 'pathQuery',
|
|
135
|
+
as: As,
|
|
136
|
+
type: Type,
|
|
137
|
+
column: string | JsonItem,
|
|
138
|
+
path: string,
|
|
139
|
+
options?: {
|
|
140
|
+
vars?: string;
|
|
141
|
+
silent?: boolean;
|
|
142
|
+
}
|
|
143
|
+
];
|
|
144
|
+
};
|
|
145
|
+
declare type SelectItem = string | RelationQuery | AggregateItem | {
|
|
146
|
+
selectAs: Record<string, string | Query | RawExpression>;
|
|
147
|
+
} | SelectFunctionItem | JsonItem | RawExpression;
|
|
148
|
+
declare type SelectFunctionItem = {
|
|
149
|
+
function: string;
|
|
150
|
+
arguments: SelectItem[];
|
|
151
|
+
as?: string;
|
|
152
|
+
};
|
|
153
|
+
declare type JoinItem = {
|
|
154
|
+
type: string;
|
|
155
|
+
args: [relation: string] | [
|
|
156
|
+
arg: string | QueryWithTable,
|
|
157
|
+
conditions: Record<string, string | RawExpression> | RawExpression | ((q: unknown) => QueryBase) | true
|
|
158
|
+
] | [
|
|
159
|
+
arg: string | QueryWithTable,
|
|
160
|
+
leftColumn: string | RawExpression,
|
|
161
|
+
rightColumn: string | RawExpression
|
|
162
|
+
] | [
|
|
163
|
+
arg: string | QueryWithTable,
|
|
164
|
+
leftColumn: string | RawExpression,
|
|
165
|
+
op: string,
|
|
166
|
+
rightColumn: string | RawExpression
|
|
167
|
+
];
|
|
168
|
+
isSubQuery: boolean;
|
|
169
|
+
};
|
|
170
|
+
declare type WhereItem = (Omit<Record<string, unknown | Record<string, unknown | Query | RawExpression> | RawExpression>, 'NOT' | 'AND' | 'OR' | 'IN' | 'EXISTS' | 'ON' | 'ON_JSON_PATH_EQUALS'> & {
|
|
171
|
+
NOT?: MaybeArray<WhereItem>;
|
|
172
|
+
AND?: MaybeArray<WhereItem>;
|
|
173
|
+
OR?: MaybeArray<WhereItem>[];
|
|
174
|
+
IN?: MaybeArray<WhereInItem>;
|
|
175
|
+
EXISTS?: MaybeArray<JoinItem['args']>;
|
|
176
|
+
ON?: WhereOnItem | WhereJsonPathEqualsItem;
|
|
177
|
+
}) | ((q: unknown) => QueryBase) | Query | RawExpression;
|
|
178
|
+
declare type WhereInItem = {
|
|
179
|
+
columns: string[];
|
|
180
|
+
values: unknown[][] | Query | RawExpression;
|
|
181
|
+
};
|
|
182
|
+
declare type WhereJsonPathEqualsItem = [
|
|
183
|
+
leftColumn: string,
|
|
184
|
+
leftPath: string,
|
|
185
|
+
rightColumn: string,
|
|
186
|
+
rightPath: string
|
|
187
|
+
];
|
|
188
|
+
declare type WhereOnItem = {
|
|
189
|
+
joinFrom: WhereOnJoinItem;
|
|
190
|
+
joinTo: WhereOnJoinItem;
|
|
191
|
+
on: [leftFullColumn: string, rightFullColumn: string] | [leftFullColumn: string, op: string, rightFullColumn: string];
|
|
192
|
+
};
|
|
193
|
+
declare type WhereOnJoinItem = {
|
|
194
|
+
table?: string;
|
|
195
|
+
query: {
|
|
196
|
+
as?: string;
|
|
197
|
+
};
|
|
198
|
+
} | string;
|
|
199
|
+
declare type AggregateItemOptions = {
|
|
200
|
+
as?: string;
|
|
201
|
+
distinct?: boolean;
|
|
202
|
+
order?: OrderItem[];
|
|
203
|
+
filter?: WhereItem;
|
|
204
|
+
filterOr?: WhereItem[];
|
|
205
|
+
withinGroup?: boolean;
|
|
206
|
+
over?: string;
|
|
207
|
+
window?: WindowItem;
|
|
208
|
+
};
|
|
209
|
+
declare type SortDir = 'ASC' | 'DESC';
|
|
210
|
+
declare type OrderItem = string | Record<string, SortDir | {
|
|
211
|
+
dir: SortDir;
|
|
212
|
+
nulls: 'FIRST' | 'LAST';
|
|
213
|
+
}> | RawExpression;
|
|
214
|
+
declare type AggregateItemArg = Expression | Record<string, Expression> | [Expression, string];
|
|
215
|
+
declare type AggregateItem = {
|
|
216
|
+
function: string;
|
|
217
|
+
arg?: AggregateItemArg;
|
|
218
|
+
options: AggregateItemOptions;
|
|
219
|
+
};
|
|
220
|
+
declare type ColumnOperators<S extends SelectableBase, Column extends keyof S> = {
|
|
221
|
+
[O in keyof S[Column]['column']['operators']]?: S[Column]['column']['operators'][O]['type'];
|
|
222
|
+
};
|
|
223
|
+
declare type HavingItemObject = Record<string, unknown>;
|
|
224
|
+
declare type HavingItem = Record<string, HavingItemObject> | {
|
|
225
|
+
count?: number | HavingItemObject;
|
|
226
|
+
} | Query | RawExpression;
|
|
227
|
+
declare type WindowItem = Record<string, WindowDeclaration | RawExpression>;
|
|
228
|
+
declare type WindowDeclaration = {
|
|
229
|
+
partitionBy?: Expression | Expression[];
|
|
230
|
+
order?: OrderItem;
|
|
231
|
+
};
|
|
232
|
+
declare type UnionItem = Query | RawExpression;
|
|
233
|
+
declare type UnionKind = 'UNION' | 'UNION ALL' | 'INTERSECT' | 'INTERSECT ALL' | 'EXCEPT' | 'EXCEPT ALL';
|
|
234
|
+
declare type OnConflictItem = string | string[] | RawExpression;
|
|
235
|
+
declare type OnConflictMergeUpdate = string | string[] | Record<string, unknown> | RawExpression;
|
|
236
|
+
|
|
237
|
+
declare type ToSqlCtx = {
|
|
238
|
+
whereQueryBuilder: typeof WhereQueryBuilder;
|
|
239
|
+
onQueryBuilder: typeof OnQueryBuilder;
|
|
240
|
+
sql: string[];
|
|
241
|
+
values: unknown[];
|
|
242
|
+
};
|
|
243
|
+
declare type toSqlCacheKey = typeof toSqlCacheKey;
|
|
244
|
+
declare const toSqlCacheKey: unique symbol;
|
|
245
|
+
declare type ToSqlOptions = {
|
|
246
|
+
clearCache?: boolean;
|
|
247
|
+
values?: unknown[];
|
|
248
|
+
};
|
|
249
|
+
declare const toSql: (table: Query, options?: ToSqlOptions) => Sql;
|
|
250
|
+
declare const makeSql: (table: Query, { values }?: ToSqlOptions) => Sql;
|
|
251
|
+
|
|
90
252
|
declare type TypeParsers = Record<number, (input: string) => unknown>;
|
|
91
253
|
declare type QueryResult<T extends QueryResultRow = any> = {
|
|
92
254
|
rowCount: number;
|
|
@@ -137,6 +299,8 @@ declare type CommonQueryData = {
|
|
|
137
299
|
throwOnNotFound?: boolean;
|
|
138
300
|
with?: WithItem[];
|
|
139
301
|
withShapes?: Record<string, ColumnsShape>;
|
|
302
|
+
joinedShapes?: Record<string, ColumnsShapeBase>;
|
|
303
|
+
joinedParsers?: Record<string, ColumnsParsers>;
|
|
140
304
|
schema?: string;
|
|
141
305
|
select?: SelectItem[];
|
|
142
306
|
as?: string;
|
|
@@ -159,8 +323,6 @@ declare type SelectQueryData = CommonQueryData & {
|
|
|
159
323
|
distinct?: Expression[];
|
|
160
324
|
fromOnly?: boolean;
|
|
161
325
|
join?: JoinItem[];
|
|
162
|
-
joinedShapes?: Record<string, ColumnsShapeBase>;
|
|
163
|
-
joinedParsers?: Record<string, ColumnsParsers>;
|
|
164
326
|
group?: (string | RawExpression)[];
|
|
165
327
|
having?: HavingItem[];
|
|
166
328
|
havingOr?: HavingItem[][];
|
|
@@ -187,8 +349,6 @@ declare type InsertQueryData = CommonQueryData & {
|
|
|
187
349
|
fromQuery?: Query;
|
|
188
350
|
using?: JoinItem[];
|
|
189
351
|
join?: JoinItem[];
|
|
190
|
-
joinedShapes?: Record<string, ColumnsShapeBase>;
|
|
191
|
-
joinedParsers?: Record<string, ColumnsParsers>;
|
|
192
352
|
onConflict?: {
|
|
193
353
|
type: 'ignore';
|
|
194
354
|
expr?: OnConflictItem;
|
|
@@ -215,8 +375,6 @@ declare type UpdateQueryData = CommonQueryData & {
|
|
|
215
375
|
declare type DeleteQueryData = CommonQueryData & {
|
|
216
376
|
type: 'delete';
|
|
217
377
|
join?: JoinItem[];
|
|
218
|
-
joinedShapes?: Record<string, ColumnsShapeBase>;
|
|
219
|
-
joinedParsers?: Record<string, ColumnsParsers>;
|
|
220
378
|
beforeDelete?: BeforeCallback[];
|
|
221
379
|
afterDelete?: AfterCallback[];
|
|
222
380
|
};
|
|
@@ -258,167 +416,6 @@ declare type CopyOptions<Column = string> = {
|
|
|
258
416
|
declare type QueryData = SelectQueryData | InsertQueryData | UpdateQueryData | DeleteQueryData | TruncateQueryData | ColumnInfoQueryData | CopyQueryData;
|
|
259
417
|
declare const cloneQueryArrays: (q: QueryData) => void;
|
|
260
418
|
|
|
261
|
-
declare type Sql = {
|
|
262
|
-
text: string;
|
|
263
|
-
values: unknown[];
|
|
264
|
-
};
|
|
265
|
-
declare const checkIfASimpleQuery: (q: QueryData) => boolean;
|
|
266
|
-
declare type WithItem = [
|
|
267
|
-
as: string,
|
|
268
|
-
options: WithOptions,
|
|
269
|
-
query: Query | RawExpression
|
|
270
|
-
];
|
|
271
|
-
declare type WithOptions = {
|
|
272
|
-
columns?: string[];
|
|
273
|
-
recursive?: true;
|
|
274
|
-
materialized?: true;
|
|
275
|
-
notMaterialized?: true;
|
|
276
|
-
};
|
|
277
|
-
declare type JsonItem<As extends string = string, Type extends ColumnTypeBase = ColumnTypeBase> = {
|
|
278
|
-
__json: [
|
|
279
|
-
kind: 'set',
|
|
280
|
-
as: As,
|
|
281
|
-
type: Type,
|
|
282
|
-
column: string | JsonItem,
|
|
283
|
-
path: Array<string | number>,
|
|
284
|
-
value: unknown,
|
|
285
|
-
options?: {
|
|
286
|
-
createIfMissing?: boolean;
|
|
287
|
-
}
|
|
288
|
-
] | [
|
|
289
|
-
kind: 'insert',
|
|
290
|
-
as: As,
|
|
291
|
-
type: Type,
|
|
292
|
-
column: string | JsonItem,
|
|
293
|
-
path: Array<string | number>,
|
|
294
|
-
value: unknown,
|
|
295
|
-
options?: {
|
|
296
|
-
insertAfter?: boolean;
|
|
297
|
-
}
|
|
298
|
-
] | [
|
|
299
|
-
kind: 'remove',
|
|
300
|
-
as: As,
|
|
301
|
-
type: Type,
|
|
302
|
-
column: string | JsonItem,
|
|
303
|
-
path: Array<string | number>
|
|
304
|
-
] | [
|
|
305
|
-
kind: 'pathQuery',
|
|
306
|
-
as: As,
|
|
307
|
-
type: Type,
|
|
308
|
-
column: string | JsonItem,
|
|
309
|
-
path: string,
|
|
310
|
-
options?: {
|
|
311
|
-
vars?: string;
|
|
312
|
-
silent?: boolean;
|
|
313
|
-
}
|
|
314
|
-
];
|
|
315
|
-
};
|
|
316
|
-
declare type SelectItem = string | RelationQuery | AggregateItem | {
|
|
317
|
-
selectAs: Record<string, string | Query | RawExpression>;
|
|
318
|
-
} | SelectFunctionItem | JsonItem | RawExpression;
|
|
319
|
-
declare type SelectFunctionItem = {
|
|
320
|
-
function: string;
|
|
321
|
-
arguments: SelectItem[];
|
|
322
|
-
as?: string;
|
|
323
|
-
};
|
|
324
|
-
declare type JoinItem = {
|
|
325
|
-
type: string;
|
|
326
|
-
args: [relation: string] | [
|
|
327
|
-
arg: string | QueryWithTable,
|
|
328
|
-
conditions: Record<string, string | RawExpression> | RawExpression | ((q: unknown) => QueryBase) | true
|
|
329
|
-
] | [
|
|
330
|
-
arg: string | QueryWithTable,
|
|
331
|
-
leftColumn: string | RawExpression,
|
|
332
|
-
rightColumn: string | RawExpression
|
|
333
|
-
] | [
|
|
334
|
-
arg: string | QueryWithTable,
|
|
335
|
-
leftColumn: string | RawExpression,
|
|
336
|
-
op: string,
|
|
337
|
-
rightColumn: string | RawExpression
|
|
338
|
-
];
|
|
339
|
-
};
|
|
340
|
-
declare type WhereItem = (Omit<Record<string, unknown | Record<string, unknown | Query | RawExpression> | RawExpression>, 'NOT' | 'AND' | 'OR' | 'IN' | 'EXISTS' | 'ON' | 'ON_JSON_PATH_EQUALS'> & {
|
|
341
|
-
NOT?: MaybeArray<WhereItem>;
|
|
342
|
-
AND?: MaybeArray<WhereItem>;
|
|
343
|
-
OR?: MaybeArray<WhereItem>[];
|
|
344
|
-
IN?: MaybeArray<WhereInItem>;
|
|
345
|
-
EXISTS?: MaybeArray<JoinItem['args']>;
|
|
346
|
-
ON?: WhereOnItem | WhereJsonPathEqualsItem;
|
|
347
|
-
}) | ((q: unknown) => QueryBase) | Query | RawExpression;
|
|
348
|
-
declare type WhereInItem = {
|
|
349
|
-
columns: string[];
|
|
350
|
-
values: unknown[][] | Query | RawExpression;
|
|
351
|
-
};
|
|
352
|
-
declare type WhereJsonPathEqualsItem = [
|
|
353
|
-
leftColumn: string,
|
|
354
|
-
leftPath: string,
|
|
355
|
-
rightColumn: string,
|
|
356
|
-
rightPath: string
|
|
357
|
-
];
|
|
358
|
-
declare type WhereOnItem = {
|
|
359
|
-
joinFrom: WhereOnJoinItem;
|
|
360
|
-
joinTo: WhereOnJoinItem;
|
|
361
|
-
on: [leftFullColumn: string, rightFullColumn: string] | [leftFullColumn: string, op: string, rightFullColumn: string];
|
|
362
|
-
};
|
|
363
|
-
declare type WhereOnJoinItem = {
|
|
364
|
-
table?: string;
|
|
365
|
-
query: {
|
|
366
|
-
as?: string;
|
|
367
|
-
};
|
|
368
|
-
} | string;
|
|
369
|
-
declare type AggregateItemOptions = {
|
|
370
|
-
as?: string;
|
|
371
|
-
distinct?: boolean;
|
|
372
|
-
order?: OrderItem[];
|
|
373
|
-
filter?: WhereItem;
|
|
374
|
-
filterOr?: WhereItem[];
|
|
375
|
-
withinGroup?: boolean;
|
|
376
|
-
over?: string;
|
|
377
|
-
window?: WindowItem;
|
|
378
|
-
};
|
|
379
|
-
declare type SortDir = 'ASC' | 'DESC';
|
|
380
|
-
declare type OrderItem = string | Record<string, SortDir | {
|
|
381
|
-
dir: SortDir;
|
|
382
|
-
nulls: 'FIRST' | 'LAST';
|
|
383
|
-
}> | RawExpression;
|
|
384
|
-
declare type AggregateItemArg = Expression | Record<string, Expression> | [Expression, string];
|
|
385
|
-
declare type AggregateItem = {
|
|
386
|
-
function: string;
|
|
387
|
-
arg?: AggregateItemArg;
|
|
388
|
-
options: AggregateItemOptions;
|
|
389
|
-
};
|
|
390
|
-
declare type ColumnOperators<S extends SelectableBase, Column extends keyof S> = {
|
|
391
|
-
[O in keyof S[Column]['column']['operators']]?: S[Column]['column']['operators'][O]['type'];
|
|
392
|
-
};
|
|
393
|
-
declare type HavingItemObject = Record<string, unknown>;
|
|
394
|
-
declare type HavingItem = Record<string, HavingItemObject> | {
|
|
395
|
-
count?: number | HavingItemObject;
|
|
396
|
-
} | Query | RawExpression;
|
|
397
|
-
declare type WindowItem = Record<string, WindowDeclaration | RawExpression>;
|
|
398
|
-
declare type WindowDeclaration = {
|
|
399
|
-
partitionBy?: Expression | Expression[];
|
|
400
|
-
order?: OrderItem;
|
|
401
|
-
};
|
|
402
|
-
declare type UnionItem = Query | RawExpression;
|
|
403
|
-
declare type UnionKind = 'UNION' | 'UNION ALL' | 'INTERSECT' | 'INTERSECT ALL' | 'EXCEPT' | 'EXCEPT ALL';
|
|
404
|
-
declare type OnConflictItem = string | string[] | RawExpression;
|
|
405
|
-
declare type OnConflictMergeUpdate = string | string[] | Record<string, unknown> | RawExpression;
|
|
406
|
-
|
|
407
|
-
declare type ToSqlCtx = {
|
|
408
|
-
whereQueryBuilder: typeof WhereQueryBuilder;
|
|
409
|
-
onQueryBuilder: typeof OnQueryBuilder;
|
|
410
|
-
sql: string[];
|
|
411
|
-
values: unknown[];
|
|
412
|
-
};
|
|
413
|
-
declare type toSqlCacheKey = typeof toSqlCacheKey;
|
|
414
|
-
declare const toSqlCacheKey: unique symbol;
|
|
415
|
-
declare type ToSqlOptions = {
|
|
416
|
-
clearCache?: boolean;
|
|
417
|
-
values?: unknown[];
|
|
418
|
-
};
|
|
419
|
-
declare const toSql: (table: Query, options?: ToSqlOptions) => Sql;
|
|
420
|
-
declare const makeSql: (table: Query, { values }?: ToSqlOptions) => Sql;
|
|
421
|
-
|
|
422
419
|
declare const getClonedQueryData: (query: QueryData) => QueryData;
|
|
423
420
|
declare const getQueryAs: (q: {
|
|
424
421
|
table?: string;
|
|
@@ -473,10 +470,10 @@ declare type SelectSubQueryResult<Arg extends Query & {
|
|
|
473
470
|
[isRequiredRelationKey]?: boolean;
|
|
474
471
|
}> = QueryReturnsAll<Arg['returnType']> extends true ? ArrayOfColumnsObjects<Arg['result']> : Arg['returnType'] extends 'valueOrThrow' ? Arg['result']['value'] : Arg['returnType'] extends 'pluck' ? PluckResultColumnType<Arg['result']['pluck']> : Arg[isRequiredRelationKey] extends true ? ColumnsObject<Arg['result']> : NullableColumn<ColumnsObject<Arg['result']>>;
|
|
475
472
|
declare const addParserForRawExpression: (q: Query, key: string | getValueKey, raw: RawExpression) => void;
|
|
476
|
-
declare const addParserForSelectItem: <T extends Query>(q: T, as: string | getValueKey | undefined, key: string, arg: RawExpression<
|
|
473
|
+
declare const addParserForSelectItem: <T extends Query>(q: T, as: string | getValueKey | undefined, key: string, arg: RawExpression<ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Exclude<keyof T["selectable"], number | symbol> | ((q: T) => Query)) => string | RawExpression | Query;
|
|
477
474
|
declare const addParserToQuery: (query: QueryData, key: string | getValueKey, parser: ColumnParser) => void;
|
|
478
475
|
declare const processSelectArg: <T extends Query>(q: T, as: string | undefined, arg: SelectArg<T>, columnAs?: string | getValueKey) => SelectItem;
|
|
479
|
-
declare const getShapeFromSelect: (q: Query) => ColumnsShapeBase;
|
|
476
|
+
declare const getShapeFromSelect: (q: Query, isSubQuery?: boolean) => ColumnsShapeBase;
|
|
480
477
|
declare class Select {
|
|
481
478
|
select<T extends Query, K extends SelectArg<T>[]>(this: T, ...args: K): SelectResult<T, K>;
|
|
482
479
|
_select<T extends Query, K extends SelectArg<T>[]>(this: T, ...args: K): SelectResult<T, K>;
|
|
@@ -501,7 +498,12 @@ declare type SetFromSelectable<T extends Query, Arg extends Query> = Omit<T, 'se
|
|
|
501
498
|
declare type MergeFromResult<T extends Query, Arg extends Query> = AddQuerySelect<Omit<T, 'result'> & {
|
|
502
499
|
result: Pick<T['result'], keyof Arg['result']>;
|
|
503
500
|
}, Arg['result']>;
|
|
504
|
-
declare type FromResult<T extends Query, Args extends FromArgs<T
|
|
501
|
+
declare type FromResult<T extends Query, Args extends FromArgs<T>, Arg = Args[0]> = Arg extends string ? T['withData'] extends Record<string, WithDataItem> ? Arg extends keyof T['withData'] ? Omit<T, 'meta' | 'selectable'> & {
|
|
502
|
+
meta: Omit<T['meta'], 'as'> & {
|
|
503
|
+
as?: string;
|
|
504
|
+
};
|
|
505
|
+
selectable: SelectableFromShape<T['withData'][Arg]['shape'], Arg>;
|
|
506
|
+
} : SetQueryTableAlias<T, Arg> : SetQueryTableAlias<T, Arg> : Arg extends Query ? SetQueryTableAlias<MergeFromResult<SetFromSelectable<T, Arg>, Arg>, AliasOrTable<Arg>> : T;
|
|
505
507
|
declare class From {
|
|
506
508
|
from<T extends Query, Args extends FromArgs<T>>(this: T, ...args: Args): FromResult<T, Args>;
|
|
507
509
|
_from<T extends Query, Args extends FromArgs<T>>(this: T, ...args: Args): FromResult<T, Args>;
|
|
@@ -516,7 +518,7 @@ declare type WhereArg<T extends QueryBase> = (Omit<{
|
|
|
516
518
|
columns: (keyof T['selectable'])[];
|
|
517
519
|
values: unknown[][] | Query | RawExpression;
|
|
518
520
|
}>;
|
|
519
|
-
EXISTS?: MaybeArray<JoinArgs<T> | JoinCallbackArg<T
|
|
521
|
+
EXISTS?: MaybeArray<JoinArgs<T> | [JoinCallbackArg<T>, JoinCallback<T, JoinCallbackArg<T>>]>;
|
|
520
522
|
}) | QueryBase | RawExpression | ((q: WhereQueryBuilder<T>) => WhereQueryBuilder);
|
|
521
523
|
declare type WhereInColumn<T extends QueryBase> = keyof T['selectable'] | [keyof T['selectable'], ...(keyof T['selectable'])[]];
|
|
522
524
|
declare type WhereInValues<T extends QueryBase, Column extends WhereInColumn<T>> = Column extends keyof T['selectable'] ? T['selectable'][Column]['column']['type'][] | Query | RawExpression : ({
|
|
@@ -546,6 +548,7 @@ declare abstract class Where implements QueryBase {
|
|
|
546
548
|
abstract relations: RelationsBase;
|
|
547
549
|
abstract withData: WithDataBase;
|
|
548
550
|
abstract baseQuery: Query;
|
|
551
|
+
abstract internal: QueryInternal;
|
|
549
552
|
query: QueryData;
|
|
550
553
|
table?: string;
|
|
551
554
|
meta: QueryMetaBase;
|
|
@@ -600,6 +603,7 @@ declare class WhereQueryBuilder<Q extends QueryBase = QueryBase> extends Where i
|
|
|
600
603
|
relations: Q['relations'];
|
|
601
604
|
baseQuery: Query;
|
|
602
605
|
withData: {};
|
|
606
|
+
internal: {};
|
|
603
607
|
constructor(q: QueryBase | string, shape: ColumnsShapeBase);
|
|
604
608
|
clone<T extends this>(this: T): T;
|
|
605
609
|
}
|
|
@@ -651,6 +655,7 @@ declare type JoinCallback<T extends QueryBase, Arg extends JoinCallbackArg<T>> =
|
|
|
651
655
|
relations: RelationsBase;
|
|
652
656
|
withData: WithDataBase;
|
|
653
657
|
meta: EmptyObject;
|
|
658
|
+
internal: QueryInternal;
|
|
654
659
|
} : never : Arg extends Query ? Arg : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['table'] : never : never>) => OnQueryBuilder;
|
|
655
660
|
declare type JoinCallbackResult<T extends Query, Arg extends JoinCallbackArg<T>> = AddQueryJoinedTable<T, Arg extends Query ? Arg : T['relations'] extends Record<string, Relation> ? Arg extends keyof T['relations'] ? T['relations'][Arg]['table'] : Arg extends keyof T['withData'] ? T['withData'][Arg] extends WithDataItem ? {
|
|
656
661
|
table: T['withData'][Arg]['table'];
|
|
@@ -696,7 +701,7 @@ declare type OnArgs<Q extends {
|
|
|
696
701
|
];
|
|
697
702
|
declare const pushQueryOn: <T extends QueryBase>(q: T, joinFrom: QueryBase | string, joinTo: QueryBase | string, ...on: OnArgs<QueryBase>) => T;
|
|
698
703
|
declare const pushQueryOrOn: typeof pushQueryOn;
|
|
699
|
-
declare const addQueryOn:
|
|
704
|
+
declare const addQueryOn: <T extends QueryBase>(q: T, joinFrom: QueryBase, joinTo: QueryBase, ...args: OnArgs<QueryBase>) => T;
|
|
700
705
|
declare const addQueryOrOn: typeof pushQueryOrOn;
|
|
701
706
|
declare type OnJsonPathEqualsArgs<T extends QueryBase> = [
|
|
702
707
|
leftColumn: keyof T['selectable'],
|
|
@@ -704,8 +709,8 @@ declare type OnJsonPathEqualsArgs<T extends QueryBase> = [
|
|
|
704
709
|
rightColumn: keyof T['selectable'],
|
|
705
710
|
rightPath: string
|
|
706
711
|
];
|
|
707
|
-
declare class OnQueryBuilder<S extends QueryBase = QueryBase, J extends QueryBase = QueryBase> extends WhereQueryBuilder<
|
|
708
|
-
selectable: Omit<S['selectable'], keyof S['shape']
|
|
712
|
+
declare class OnQueryBuilder<S extends QueryBase = QueryBase, J extends QueryBase = QueryBase> extends WhereQueryBuilder<J & {
|
|
713
|
+
selectable: Omit<S['selectable'], keyof S['shape']>;
|
|
709
714
|
}> implements QueryBase {
|
|
710
715
|
joinTo: QueryBase;
|
|
711
716
|
constructor(q: QueryBase | string, shape: ColumnsShapeBase, joinTo: QueryBase);
|
|
@@ -755,9 +760,9 @@ declare class NotFoundError extends PormError {
|
|
|
755
760
|
}
|
|
756
761
|
declare class MoreThanOneRowError extends PormError {
|
|
757
762
|
}
|
|
758
|
-
declare class
|
|
763
|
+
declare class OrchidInternalError extends Error {
|
|
759
764
|
}
|
|
760
|
-
declare class UnhandledTypeError extends
|
|
765
|
+
declare class UnhandledTypeError extends OrchidInternalError {
|
|
761
766
|
constructor(value: never);
|
|
762
767
|
}
|
|
763
768
|
|
|
@@ -768,6 +773,7 @@ declare type DbOptions<CT extends ColumnTypesBase> = ({
|
|
|
768
773
|
columnTypes?: CT | ((t: DefaultColumnTypes) => CT);
|
|
769
774
|
autoPreparedStatements?: boolean;
|
|
770
775
|
noPrimaryKey?: NoPrimaryKeyOption;
|
|
776
|
+
snakeCase?: boolean;
|
|
771
777
|
};
|
|
772
778
|
declare type DbTableOptions = {
|
|
773
779
|
schema?: string;
|
|
@@ -782,17 +788,7 @@ interface Db<Table extends string | undefined = undefined, Shape extends Columns
|
|
|
782
788
|
onQueryBuilder: Query['onQueryBuilder'];
|
|
783
789
|
primaryKeys: Query['primaryKeys'];
|
|
784
790
|
query: QueryData;
|
|
785
|
-
selectable:
|
|
786
|
-
[K in keyof Shape]: {
|
|
787
|
-
as: K;
|
|
788
|
-
column: Shape[K];
|
|
789
|
-
};
|
|
790
|
-
} & {
|
|
791
|
-
[K in keyof Shape as `${Table}.${StringKey<K>}`]: {
|
|
792
|
-
as: K;
|
|
793
|
-
column: Shape[K];
|
|
794
|
-
};
|
|
795
|
-
};
|
|
791
|
+
selectable: SelectableFromShape<Shape, Table>;
|
|
796
792
|
returnType: Query['returnType'];
|
|
797
793
|
then: ThenResult<Pick<ColumnShapeOutput<Shape>, DefaultSelectColumns<Shape>[number]>[]>;
|
|
798
794
|
joinedTables: Query['joinedTables'];
|
|
@@ -839,7 +835,9 @@ declare class With {
|
|
|
839
835
|
}
|
|
840
836
|
|
|
841
837
|
declare type UnionArg<T extends Query> = (Omit<Query, 'result'> & {
|
|
842
|
-
result:
|
|
838
|
+
result: {
|
|
839
|
+
[K in keyof T['result']]: Pick<T['result'][K], 'dataType'>;
|
|
840
|
+
};
|
|
843
841
|
}) | RawExpression;
|
|
844
842
|
declare class Union {
|
|
845
843
|
union<T extends Query>(this: T, args: UnionArg<T>[], wrap?: boolean): T;
|
|
@@ -921,9 +919,15 @@ declare type OmitBelongsToForeignKeys<R extends RelationsBase, Data> = Omit<Data
|
|
|
921
919
|
declare type CreateRelationData<T extends Query> = {
|
|
922
920
|
[K in keyof T['relations']]: T['relations'][K] extends BelongsToRelation ? CreateBelongsToData<T, K, T['relations'][K]> : T['relations'][K] extends HasOneRelation ? CreateHasOneData<T, K, T['relations'][K]> : T['relations'][K] extends HasManyRelation | HasAndBelongsToManyRelation ? CreateHasManyData<T, K, T['relations'][K]> : EmptyObject;
|
|
923
921
|
}[keyof T['relations']];
|
|
924
|
-
declare type CreateBelongsToData<T extends Query, Key extends keyof T['relations'], Rel extends BelongsToRelation
|
|
922
|
+
declare type CreateBelongsToData<T extends Query, Key extends keyof T['relations'], Rel extends BelongsToRelation, FKeys = {
|
|
925
923
|
[K in Rel['options']['foreignKey']]: Rel['options']['foreignKey'] extends keyof T['inputType'] ? T['inputType'][Rel['options']['foreignKey']] : never;
|
|
926
|
-
}
|
|
924
|
+
}> = {
|
|
925
|
+
[K in keyof FKeys]: K extends keyof T[defaultsKey] ? {
|
|
926
|
+
[L in K]?: FKeys[L];
|
|
927
|
+
} : {
|
|
928
|
+
[L in K]: FKeys[L];
|
|
929
|
+
};
|
|
930
|
+
}[keyof FKeys] | {
|
|
927
931
|
[K in Key]: {
|
|
928
932
|
create: CreateData<Rel['nestedCreateQuery']>;
|
|
929
933
|
connect?: never;
|
|
@@ -1481,6 +1485,17 @@ declare type SelectableBase = Record<PropertyKey, {
|
|
|
1481
1485
|
as: string;
|
|
1482
1486
|
column: ColumnType;
|
|
1483
1487
|
}>;
|
|
1488
|
+
declare type SelectableFromShape<Shape extends ColumnsShapeBase, Table extends string | undefined> = {
|
|
1489
|
+
[K in keyof Shape]: {
|
|
1490
|
+
as: K;
|
|
1491
|
+
column: Shape[K];
|
|
1492
|
+
};
|
|
1493
|
+
} & {
|
|
1494
|
+
[K in keyof Shape as `${Table}.${StringKey<K>}`]: {
|
|
1495
|
+
as: K;
|
|
1496
|
+
column: Shape[K];
|
|
1497
|
+
};
|
|
1498
|
+
};
|
|
1484
1499
|
declare type WithDataItem = {
|
|
1485
1500
|
table: string;
|
|
1486
1501
|
shape: ColumnsShape;
|
|
@@ -1881,7 +1896,6 @@ declare type ColumnData = ColumnDataBase & {
|
|
|
1881
1896
|
collate?: string;
|
|
1882
1897
|
compression?: string;
|
|
1883
1898
|
foreignKeys?: ForeignKey<string, string[]>[];
|
|
1884
|
-
modifyQuery?: (q: Query) => void;
|
|
1885
1899
|
};
|
|
1886
1900
|
declare type ForeignKeyMatch = 'FULL' | 'PARTIAL' | 'SIMPLE';
|
|
1887
1901
|
declare type ForeignKeyAction = 'NO ACTION' | 'RESTRICT' | 'CASCADE' | 'SET NULL' | 'SET DEFAULT';
|
|
@@ -1960,7 +1974,6 @@ declare abstract class ColumnType<Type = unknown, Ops extends BaseOperators = Ba
|
|
|
1960
1974
|
};
|
|
1961
1975
|
as<T extends ColumnType, C extends ColumnType<T['type'], BaseOperators, T['inputType']>>(this: T, column: C): C;
|
|
1962
1976
|
toSQL(): string;
|
|
1963
|
-
default<T extends ColumnType, Value extends T['type'] | RawExpression>(this: T, value: Value): ColumnWithDefault<T, Value>;
|
|
1964
1977
|
index<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column'>): T;
|
|
1965
1978
|
unique<T extends ColumnType>(this: T, options?: Omit<SingleColumnIndexOptions, 'column' | 'unique'>): T;
|
|
1966
1979
|
comment<T extends ColumnType>(this: T, comment: string): T;
|
|
@@ -1989,7 +2002,7 @@ declare type NumberMethods = typeof numberTypeMethods;
|
|
|
1989
2002
|
interface NumberBaseColumn extends ColumnType<number, typeof Operators.number>, NumberMethods {
|
|
1990
2003
|
}
|
|
1991
2004
|
declare abstract class NumberBaseColumn extends ColumnType<number, typeof Operators.number> {
|
|
1992
|
-
data:
|
|
2005
|
+
data: NumberColumnData;
|
|
1993
2006
|
operators: {
|
|
1994
2007
|
lt: ((key: string, value: number | RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query, values: unknown[]) => string) & {
|
|
1995
2008
|
type: number | RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query;
|
|
@@ -2021,10 +2034,10 @@ declare abstract class NumberBaseColumn extends ColumnType<number, typeof Operat
|
|
|
2021
2034
|
};
|
|
2022
2035
|
}
|
|
2023
2036
|
declare abstract class IntegerBaseColumn extends NumberBaseColumn {
|
|
2024
|
-
data:
|
|
2037
|
+
data: NumberColumnData;
|
|
2038
|
+
constructor(types: ColumnTypesBase);
|
|
2025
2039
|
}
|
|
2026
2040
|
declare abstract class NumberAsStringBaseColumn extends ColumnType<string, typeof Operators.number> {
|
|
2027
|
-
data: {};
|
|
2028
2041
|
operators: {
|
|
2029
2042
|
lt: ((key: string, value: number | RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query, values: unknown[]) => string) & {
|
|
2030
2043
|
type: number | RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query;
|
|
@@ -2120,20 +2133,25 @@ declare class DoublePrecisionColumn extends NumberAsStringBaseColumn {
|
|
|
2120
2133
|
toCode(t: string): Code;
|
|
2121
2134
|
}
|
|
2122
2135
|
declare class SmallSerialColumn extends IntegerBaseColumn {
|
|
2123
|
-
dataType: "
|
|
2136
|
+
dataType: "smallint";
|
|
2124
2137
|
parseItem: typeof parseInt;
|
|
2125
2138
|
data: SerialColumnData;
|
|
2139
|
+
constructor(types: ColumnTypesBase);
|
|
2140
|
+
toSQL(): string;
|
|
2126
2141
|
toCode(t: string): Code;
|
|
2127
2142
|
}
|
|
2128
2143
|
declare class SerialColumn extends IntegerBaseColumn {
|
|
2129
|
-
dataType: "
|
|
2144
|
+
dataType: "integer";
|
|
2130
2145
|
parseItem: typeof parseInt;
|
|
2131
2146
|
data: SerialColumnData;
|
|
2147
|
+
constructor(types: ColumnTypesBase);
|
|
2148
|
+
toSQL(): string;
|
|
2132
2149
|
toCode(t: string): Code;
|
|
2133
2150
|
}
|
|
2134
2151
|
declare class BigSerialColumn extends NumberAsStringBaseColumn {
|
|
2135
|
-
dataType: "
|
|
2152
|
+
dataType: "bigint";
|
|
2136
2153
|
data: SerialColumnData;
|
|
2154
|
+
toSql(): string;
|
|
2137
2155
|
toCode(t: string): Code;
|
|
2138
2156
|
}
|
|
2139
2157
|
|
|
@@ -2245,7 +2263,7 @@ declare const textMethods: {
|
|
|
2245
2263
|
interface TextBaseColumn extends ColumnType<string, typeof Operators.text>, TextMethods {
|
|
2246
2264
|
}
|
|
2247
2265
|
declare abstract class TextBaseColumn extends ColumnType<string, typeof Operators.text> {
|
|
2248
|
-
data:
|
|
2266
|
+
data: TextColumnData;
|
|
2249
2267
|
operators: {
|
|
2250
2268
|
contains: ((key: string, value: string | orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query, values: unknown[]) => string) & {
|
|
2251
2269
|
type: string | orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query;
|
|
@@ -2328,22 +2346,9 @@ declare class TextColumn extends TextBaseColumn {
|
|
|
2328
2346
|
type: string[] | orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>> | Query;
|
|
2329
2347
|
};
|
|
2330
2348
|
};
|
|
2331
|
-
data:
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
length?: number | undefined;
|
|
2335
|
-
email?: boolean | undefined;
|
|
2336
|
-
url?: boolean | undefined;
|
|
2337
|
-
uuid?: boolean | undefined;
|
|
2338
|
-
cuid?: boolean | undefined;
|
|
2339
|
-
regex?: RegExp | undefined;
|
|
2340
|
-
startsWith?: string | undefined;
|
|
2341
|
-
endsWith?: string | undefined;
|
|
2342
|
-
trim?: boolean | undefined;
|
|
2343
|
-
isNonEmpty?: true | undefined;
|
|
2344
|
-
} & {
|
|
2345
|
-
minArg?: number | undefined;
|
|
2346
|
-
maxArg?: number | undefined;
|
|
2349
|
+
data: TextColumnData & {
|
|
2350
|
+
minArg?: number;
|
|
2351
|
+
maxArg?: number;
|
|
2347
2352
|
};
|
|
2348
2353
|
constructor(types: ColumnTypesBase, minArg?: number, maxArg?: number);
|
|
2349
2354
|
toCode(t: string): Code;
|
|
@@ -3345,16 +3350,28 @@ declare const getTableData: () => TableData;
|
|
|
3345
3350
|
declare const resetTableData: (data?: TableData) => void;
|
|
3346
3351
|
declare const getColumnTypes: <CT extends ColumnTypesBase, Shape extends ColumnsShape>(types: CT, fn: (t: CT) => Shape, data?: TableData) => Shape;
|
|
3347
3352
|
declare function text(this: ColumnTypesBase, min: number, max: number): TextColumn;
|
|
3348
|
-
declare function timestamps<T extends ColumnType>(this: {
|
|
3349
|
-
timestamp(): T;
|
|
3350
|
-
}): {
|
|
3351
|
-
createdAt: ColumnWithDefault<T, RawExpression>;
|
|
3352
|
-
updatedAt: ColumnWithDefault<T, RawExpression>;
|
|
3353
|
-
};
|
|
3354
3353
|
declare type DefaultColumnTypes = typeof columnTypes;
|
|
3355
3354
|
declare const columnTypes: {
|
|
3355
|
+
timestamps: <T extends orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>(this: {
|
|
3356
|
+
name(name: string): {
|
|
3357
|
+
timestamp(): T;
|
|
3358
|
+
};
|
|
3359
|
+
timestamp(): T;
|
|
3360
|
+
}) => {
|
|
3361
|
+
createdAt: orchid_core.ColumnWithDefault<T, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
|
|
3362
|
+
updatedAt: orchid_core.ColumnWithDefault<T, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
|
|
3363
|
+
};
|
|
3364
|
+
timestampsSnakeCase: <T_1 extends orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>(this: {
|
|
3365
|
+
name(name: string): {
|
|
3366
|
+
timestamp(): T_1;
|
|
3367
|
+
};
|
|
3368
|
+
timestamp(): T_1;
|
|
3369
|
+
}) => {
|
|
3370
|
+
createdAt: orchid_core.ColumnWithDefault<T_1, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
|
|
3371
|
+
updatedAt: orchid_core.ColumnWithDefault<T_1, orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>>;
|
|
3372
|
+
};
|
|
3356
3373
|
name: typeof name;
|
|
3357
|
-
raw: (sql: string, values?: false | Record<string, unknown> | undefined) => RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>;
|
|
3374
|
+
raw: (sql: string, values?: false | Record<string, unknown> | undefined) => orchid_core.RawExpression<orchid_core.ColumnTypeBase<unknown, orchid_core.BaseOperators, unknown, orchid_core.ColumnDataBase>>;
|
|
3358
3375
|
smallint(this: ColumnTypesBase): SmallIntColumn;
|
|
3359
3376
|
integer(this: ColumnTypesBase): IntegerColumn;
|
|
3360
3377
|
bigint(this: ColumnTypesBase): BigIntColumn;
|
|
@@ -3378,7 +3395,7 @@ declare const columnTypes: {
|
|
|
3378
3395
|
timeWithTimeZone<Precision_5 extends number | undefined = undefined>(this: ColumnTypesBase, precision?: Precision_5 | undefined): TimeWithTimeZoneColumn<Precision_5>;
|
|
3379
3396
|
interval<Fields extends string | undefined = undefined, Precision_6 extends number | undefined = undefined>(this: ColumnTypesBase, fields?: Fields | undefined, precision?: Precision_6 | undefined): IntervalColumn<Fields, Precision_6>;
|
|
3380
3397
|
boolean(this: ColumnTypesBase): BooleanColumn;
|
|
3381
|
-
enum<U extends string,
|
|
3398
|
+
enum<U extends string, T_2 extends [U, ...U[]]>(this: ColumnTypesBase, dataType: string, type: T_2): EnumColumn<U, T_2>;
|
|
3382
3399
|
point(this: ColumnTypesBase): PointColumn;
|
|
3383
3400
|
line(this: ColumnTypesBase): LineColumn;
|
|
3384
3401
|
lseg(this: ColumnTypesBase): LsegColumn;
|
|
@@ -3399,7 +3416,6 @@ declare const columnTypes: {
|
|
|
3399
3416
|
json<Type extends JSONTypeAny>(this: ColumnTypesBase, schemaOrFn: Type | ((j: JSONTypes) => Type)): JSONColumn<Type>;
|
|
3400
3417
|
jsonText(this: ColumnTypesBase): JSONTextColumn;
|
|
3401
3418
|
array<Item extends ColumnType<unknown, orchid_core.BaseOperators, unknown>>(this: ColumnTypesBase, item: Item): ArrayColumn<Item>;
|
|
3402
|
-
timestamps: typeof timestamps;
|
|
3403
3419
|
primaryKey(columns: string[], options?: {
|
|
3404
3420
|
name?: string;
|
|
3405
3421
|
}): {};
|
|
@@ -3475,4 +3491,4 @@ declare const setQueryObjectValue: <T extends {
|
|
|
3475
3491
|
query: QueryData;
|
|
3476
3492
|
}>(q: T, object: string, key: string, value: unknown) => T;
|
|
3477
3493
|
|
|
3478
|
-
export { Adapter, AdapterOptions, AddQueryJoinedTable, AddQuerySelect, AddQueryWith, AfterCallback, Aggregate, Aggregate1ArgumentTypes, AggregateArg, AggregateItem, AggregateItemArg, AggregateItemOptions, AggregateOptions, AliasOrTable, ArrayColumn, ArrayData, ArrayOfColumnsObjects, BaseRelation, BeforeCallback, BelongsToRelation, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BooleanExpression, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ClearStatement, ColumnData, ColumnFromDbParams, ColumnInfo, ColumnInfoMethods, ColumnInfoQueryData, ColumnNameOfTable, ColumnOperators, ColumnParser, ColumnType, ColumnTypes, ColumnsObject, ColumnsParsers, ColumnsShape, CommonQueryData, CopyOptions, CopyQueryData, Create, CreateCtx, CreateData, CreateMethodsNames, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeWithTimeZoneBaseClass, Db, DbOptions, DbResult, DbTableOptions, DecimalBaseColumn, DecimalColumn, DefaultColumnTypes, Delete, DeleteMethodsNames, DeleteQueryData, DoublePrecisionColumn, DropMode, EnumColumn, Expression, ExpressionOfType, ExpressionOutput, For, ForeignKey, ForeignKeyOptions, ForeignKeyTable, ForeignKeyTableWithColumns, From, FromArgs, FromResult, GetArg, HasAndBelongsToManyRelation, HasManyRelation, HasOneRelation, Having, HavingArg, HavingItem, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, JSONTypes, Join, JoinArgs, JoinCallback, JoinCallbackArg, JoinItem, JoinedTablesBase, Json, JsonItem, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NoPrimaryKeyOption, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, NumberExpression, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operators, OrderArg, OrderItem, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError,
|
|
3494
|
+
export { Adapter, AdapterOptions, AddQueryJoinedTable, AddQuerySelect, AddQueryWith, AfterCallback, Aggregate, Aggregate1ArgumentTypes, AggregateArg, AggregateItem, AggregateItemArg, AggregateItemOptions, AggregateOptions, AliasOrTable, ArrayColumn, ArrayData, ArrayOfColumnsObjects, BaseRelation, BeforeCallback, BelongsToRelation, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BooleanExpression, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, Clear, ClearStatement, ColumnData, ColumnFromDbParams, ColumnInfo, ColumnInfoMethods, ColumnInfoQueryData, ColumnNameOfTable, ColumnOperators, ColumnParser, ColumnType, ColumnTypes, ColumnsObject, ColumnsParsers, ColumnsShape, CommonQueryData, CopyOptions, CopyQueryData, Create, CreateCtx, CreateData, CreateMethodsNames, DateBaseColumn, DateColumn, DateTimeBaseClass, DateTimeWithTimeZoneBaseClass, Db, DbOptions, DbResult, DbTableOptions, DecimalBaseColumn, DecimalColumn, DefaultColumnTypes, Delete, DeleteMethodsNames, DeleteQueryData, DoublePrecisionColumn, DropMode, EnumColumn, Expression, ExpressionOfType, ExpressionOutput, For, ForeignKey, ForeignKeyOptions, ForeignKeyTable, ForeignKeyTableWithColumns, From, FromArgs, FromResult, GetArg, HasAndBelongsToManyRelation, HasManyRelation, HasOneRelation, Having, HavingArg, HavingItem, IndexColumnOptions, IndexOptions, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, JSONColumn, JSONTextColumn, JSONTypes, Join, JoinArgs, JoinCallback, JoinCallbackArg, JoinItem, JoinResult, JoinedTablesBase, Json, JsonItem, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NoPrimaryKeyOption, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumn, NumberColumnData, NumberExpression, OnConflictItem, OnConflictMergeUpdate, OnConflictQueryBuilder, OnQueryBuilder, Operators, OrchidInternalError, OrderArg, OrderItem, PathColumn, PluckResultColumnType, PointColumn, PolygonColumn, PormError, Query, QueryArraysResult, QueryBase, QueryCallbacks, QueryData, QueryError, QueryErrorName, QueryGet, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMethods, QueryResult, QueryReturnType, QueryReturnsAll, QuerySelectAll, QueryThen, QueryUpsertOrCreate, QueryWithTable, RawMethods, RealColumn, Relation, RelationQuery, RelationQueryBase, RelationQueryData, RelationsBase, Select, SelectAgg, SelectArg, SelectFunctionItem, SelectItem, SelectQueryData, Selectable, SelectableBase, SelectableFromShape, SerialColumn, SerialColumnData, SetQueryJoinedTables, SetQueryReturns, SetQueryReturnsAll, SetQueryReturnsColumnInfo, SetQueryReturnsOne, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValue, SetQueryReturnsValueOptional, SetQueryReturnsVoid, SetQueryTableAlias, SetQueryWindows, SetQueryWith, SingleColumnIndexOptions, SmallIntColumn, SmallSerialColumn, SortDir, Sql, StringColumn, StringExpression, TableData, TextBaseColumn, TextColumn, TextColumnData, Then, TimeColumn, TimeInterval, TimeWithTimeZoneColumn, TimestampColumn, TimestampWithTimeZoneColumn, ToSqlCtx, ToSqlOptions, Transaction, TransactionAdapter, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionKind, Update, UpdateCtx, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdatedAtDataInjector, UpsertData, UpsertResult, UpsertThis, VarCharColumn, VirtualColumn, Where, WhereArg, WhereInArg, WhereInColumn, WhereInItem, WhereInValues, WhereItem, WhereJsonPathEqualsItem, WhereOnItem, WhereOnJoinItem, WhereQueryBuilder, WhereResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowFunctionOptions, WindowItem, With, WithDataBase, WithDataItem, WithItem, WithOptions, XMLColumn, addOr, addOrNot, addParserForRawExpression, addParserForSelectItem, addParserToQuery, addQueryOn, addQueryOrOn, addWhere, addWhereIn, addWhereNot, aggregate1FunctionNames, anyShape, checkIfASimpleQuery, cloneQueryArrays, codeToString, columnCode, columnDefaultArgumentToCode, columnForeignKeysToCode, columnIndexesToCode, columnTypes, utils as columnUtils, columnsByType, columnsShapeToCode, createDb, defaultsKey, foreignKeyArgsToCode, foreignKeyArgumentToCode, foreignKeyToCode, getClonedQueryData, getColumnTypes, getQueryAs, getRaw, getShapeFromSelect, getTableData, getValueKey, handleResult, indexToCode, instantiateColumn, isQueryReturnsAll, isRequiredRelationKey, jsonTypes, logColors, logParamToLogObject, makeRegexToFindInSql, makeSql, newTableData, parseRecord, parseResult, primaryKeyToCode, processSelectArg, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, queryMethodByReturnType, queryTypeWithLimitOne, quote, quoteString, relationQueryKey, resetTableData, setQueryObjectValue, toSql, toSqlCacheKey };
|