pqb 0.30.7 → 0.31.0
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 +272 -216
- package/dist/index.js +245 -213
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +243 -212
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -106,11 +106,12 @@ interface QueryBaseThen<T> extends QueryBase {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
declare const checkIfASimpleQuery: (q: Query) => boolean;
|
|
109
|
-
type WithItem =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
type WithItem = {
|
|
110
|
+
n: string;
|
|
111
|
+
o?: WithOptions;
|
|
112
|
+
q?: Query;
|
|
113
|
+
s?: Expression;
|
|
114
|
+
};
|
|
114
115
|
interface WithOptions {
|
|
115
116
|
columns?: string[];
|
|
116
117
|
recursive?: true;
|
|
@@ -288,7 +289,14 @@ interface WindowDeclaration {
|
|
|
288
289
|
partitionBy?: SelectableOrExpression | SelectableOrExpression[];
|
|
289
290
|
order?: OrderItem;
|
|
290
291
|
}
|
|
291
|
-
|
|
292
|
+
interface UnionItem {
|
|
293
|
+
a: Query | Expression;
|
|
294
|
+
k: UnionKind;
|
|
295
|
+
}
|
|
296
|
+
interface UnionSet {
|
|
297
|
+
b: Query;
|
|
298
|
+
u: UnionItem[];
|
|
299
|
+
}
|
|
292
300
|
type UnionKind = 'UNION' | 'UNION ALL' | 'INTERSECT' | 'INTERSECT ALL' | 'EXCEPT' | 'EXCEPT ALL';
|
|
293
301
|
type OnConflictTarget = string | string[] | Expression | {
|
|
294
302
|
constraint: string;
|
|
@@ -461,10 +469,9 @@ interface SelectQueryData extends CommonQueryData {
|
|
|
461
469
|
having?: HavingItem[];
|
|
462
470
|
window?: WindowItem[];
|
|
463
471
|
union?: {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}[];
|
|
472
|
+
b: Query;
|
|
473
|
+
u: UnionItem[];
|
|
474
|
+
};
|
|
468
475
|
order?: OrderItem[];
|
|
469
476
|
returnsOne?: true;
|
|
470
477
|
limit?: number;
|
|
@@ -4400,15 +4407,10 @@ type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (
|
|
|
4400
4407
|
type FromResult<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>> = Arg extends string ? T['withData'] extends WithDataItems ? {
|
|
4401
4408
|
[K in keyof T]: K extends 'meta' ? {
|
|
4402
4409
|
[K in keyof T['meta']]: K extends 'as' ? string | undefined : K extends 'selectable' ? SelectableFromShape<T['withData'][Arg]['shape'], Arg> : T['meta'][K];
|
|
4403
|
-
} : T[K];
|
|
4410
|
+
} : K extends 'result' ? T['withData'][Arg]['shape'] : K extends 'then' ? QueryThen<GetQueryResult<T, T['withData'][Arg]['shape']>> : T[K];
|
|
4404
4411
|
} : SetQueryTableAlias<T, Arg> : Arg extends PickQueryTableMetaResult ? {
|
|
4405
4412
|
[K in keyof T]: K extends 'meta' ? {
|
|
4406
|
-
[K in keyof T['meta']]: K extends 'as' ? AliasOrTable<Arg> : K extends 'selectable' ?
|
|
4407
|
-
[K in keyof Arg['result']]: K extends string ? {
|
|
4408
|
-
as: K;
|
|
4409
|
-
column: Arg['result'][K];
|
|
4410
|
-
} : never;
|
|
4411
|
-
} : T['meta'][K];
|
|
4413
|
+
[K in keyof T['meta']]: K extends 'as' ? AliasOrTable<Arg> : K extends 'selectable' ? SelectableFromShape<Arg['result'], AliasOrTable<Arg>> : T['meta'][K];
|
|
4412
4414
|
} : K extends 'result' ? Arg['result'] : K extends 'shape' ? Arg['result'] : K extends 'then' ? QueryThen<GetQueryResult<T, Arg['result']>> : T[K];
|
|
4413
4415
|
} : Arg extends (infer A)[] ? {
|
|
4414
4416
|
[K in keyof T]: K extends 'meta' ? {
|
|
@@ -4427,7 +4429,7 @@ type FromResult<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>> = A
|
|
|
4427
4429
|
} : T;
|
|
4428
4430
|
declare function queryFrom<T extends FromQuerySelf, Arg extends MaybeArray<FromArg<T>>>(self: T, arg: Arg): FromResult<T, Arg>;
|
|
4429
4431
|
declare function queryFromSql<T extends FromQuerySelf>(self: T, args: SQLQueryArgs): T;
|
|
4430
|
-
declare class
|
|
4432
|
+
declare class FromMethods {
|
|
4431
4433
|
/**
|
|
4432
4434
|
* Set the `FROM` value, by default the table name is used.
|
|
4433
4435
|
*
|
|
@@ -5091,16 +5093,178 @@ declare class Select {
|
|
|
5091
5093
|
selectAll<T extends SelectSelf>(this: T): SelectResult<T, ['*']>;
|
|
5092
5094
|
}
|
|
5093
5095
|
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
+
declare class SqlMethod<ColumnTypes> {
|
|
5097
|
+
/**
|
|
5098
|
+
* When there is a need to use a piece of raw SQL, use the `sql` exported from the `BaseTable` file, it is also attached to query objects for convenience.
|
|
5099
|
+
*
|
|
5100
|
+
* When selecting a custom SQL, specify a resulting type with `<generic>` syntax:
|
|
5101
|
+
*
|
|
5102
|
+
* ```ts
|
|
5103
|
+
* import { sql } from './baseTable';
|
|
5104
|
+
*
|
|
5105
|
+
* const result: { num: number }[] = await db.table.select({
|
|
5106
|
+
* num: sql<number>`random() * 100`,
|
|
5107
|
+
* });
|
|
5108
|
+
* ```
|
|
5109
|
+
*
|
|
5110
|
+
* In a situation when you want the result to be parsed, such as when returning a timestamp that you want to be parsed into a `Date` object, provide a column type in such a way:
|
|
5111
|
+
*
|
|
5112
|
+
* This example assumes that the `timestamp` column was overridden with `asDate` as shown in [Override column types](/guide/columns-overview#override-column-types).
|
|
5113
|
+
*
|
|
5114
|
+
* ```ts
|
|
5115
|
+
* import { sql } from './baseTable';
|
|
5116
|
+
*
|
|
5117
|
+
* const result: { timestamp: Date }[] = await db.table.select({
|
|
5118
|
+
* timestamp: sql`now()`.type((t) => t.timestamp()),
|
|
5119
|
+
* });
|
|
5120
|
+
* ```
|
|
5121
|
+
*
|
|
5122
|
+
* In some cases such as when using [from](/guide/orm-and-query-builder.html#from), setting column type via callback allows for special `where` operations:
|
|
5123
|
+
*
|
|
5124
|
+
* ```ts
|
|
5125
|
+
* const subQuery = db.someTable.select({
|
|
5126
|
+
* sum: (q) => q.sql`$a + $b`.type((t) => t.decimal()).values({ a: 1, b: 2 }),
|
|
5127
|
+
* });
|
|
5128
|
+
*
|
|
5129
|
+
* // `gt`, `gte`, `min`, `lt`, `lte`, `max` in `where`
|
|
5130
|
+
* // are allowed only for numeric columns:
|
|
5131
|
+
* const result = await db.$from(subQuery).where({ sum: { gte: 5 } });
|
|
5132
|
+
* ```
|
|
5133
|
+
*
|
|
5134
|
+
* Many query methods have a version suffixed with `Sql`, you can pass an SQL template literal directly to these methods.
|
|
5135
|
+
* These methods are: `whereSql`, `whereNotSql`, `orderSql`, `havingSql`, `fromSql`, `findBySql`.
|
|
5136
|
+
*
|
|
5137
|
+
* ```ts
|
|
5138
|
+
* await db.table.whereSql`"someValue" = random() * 100`;
|
|
5139
|
+
* ```
|
|
5140
|
+
*
|
|
5141
|
+
* Interpolating values in template literals is completely safe:
|
|
5142
|
+
*
|
|
5143
|
+
* ```ts
|
|
5144
|
+
* // get value from user-provided params
|
|
5145
|
+
* const { value } = req.params;
|
|
5146
|
+
*
|
|
5147
|
+
* // SQL injection is prevented by a library, this is safe:
|
|
5148
|
+
* await db.table.whereSql`column = ${value}`;
|
|
5149
|
+
* ```
|
|
5150
|
+
*
|
|
5151
|
+
* In the example above, TS cannot check if the table has `column` column, or if there are joined tables that have such column which will lead to error.
|
|
5152
|
+
* Instead, use the [column](/guide/sql-expressions#column) or [ref](/guide/sql-expressions#ref) to reference a column:
|
|
5153
|
+
*
|
|
5154
|
+
* ```ts
|
|
5155
|
+
* // ids will be prefixed with proper table names, no ambiguity:
|
|
5156
|
+
* db.table.join(db.otherTable, 'id', 'otherId').where`
|
|
5157
|
+
* ${db.table.column('id')} = 1 AND
|
|
5158
|
+
* ${db.otherTable.ref('id')} = 2
|
|
5159
|
+
* `;
|
|
5160
|
+
* ```
|
|
5161
|
+
*
|
|
5162
|
+
* SQL can be passed with a simple string, it's important to note that this is not safe to interpolate values in it.
|
|
5163
|
+
*
|
|
5164
|
+
* ```ts
|
|
5165
|
+
* import { sql } from './baseTable';
|
|
5166
|
+
*
|
|
5167
|
+
* // no interpolation is okay
|
|
5168
|
+
* await db.table.where(sql({ raw: 'column = random() * 100' }));
|
|
5169
|
+
*
|
|
5170
|
+
* // get value from user-provided params
|
|
5171
|
+
* const { value } = req.params;
|
|
5172
|
+
*
|
|
5173
|
+
* // this is NOT safe, SQL injection is possible:
|
|
5174
|
+
* await db.table.where(sql({ raw: `column = random() * ${value}` }));
|
|
5175
|
+
* ```
|
|
5176
|
+
*
|
|
5177
|
+
* To inject values into `sql({ raw: '...' })` SQL strings, denote it with `$` in the string and provide `values` object.
|
|
5178
|
+
*
|
|
5179
|
+
* Use `$$` to provide column or/and table name (`column` or `ref` are preferable). Column names will be quoted so don't quote them manually.
|
|
5180
|
+
*
|
|
5181
|
+
* ```ts
|
|
5182
|
+
* import { sql } from './baseTable';
|
|
5183
|
+
*
|
|
5184
|
+
* // get value from user-provided params
|
|
5185
|
+
* const { value } = req.params;
|
|
5186
|
+
*
|
|
5187
|
+
* // this is SAFE, SQL injection are prevented:
|
|
5188
|
+
* await db.table.where(
|
|
5189
|
+
* sql<boolean>({
|
|
5190
|
+
* raw: '$$column = random() * $value',
|
|
5191
|
+
* values: {
|
|
5192
|
+
* column: 'someTable.someColumn', // or simply 'column'
|
|
5193
|
+
* one: value,
|
|
5194
|
+
* two: 123,
|
|
5195
|
+
* },
|
|
5196
|
+
* }),
|
|
5197
|
+
* );
|
|
5198
|
+
* ```
|
|
5199
|
+
*
|
|
5200
|
+
* Summarizing:
|
|
5201
|
+
*
|
|
5202
|
+
* ```ts
|
|
5203
|
+
* import { sql } from './baseTable';
|
|
5204
|
+
*
|
|
5205
|
+
* // simplest form:
|
|
5206
|
+
* sql`key = ${value}`;
|
|
5207
|
+
*
|
|
5208
|
+
* // with resulting type:
|
|
5209
|
+
* sql<boolean>`key = ${value}`;
|
|
5210
|
+
*
|
|
5211
|
+
* // with column type for select:
|
|
5212
|
+
* sql`key = ${value}`.type((t) => t.boolean());
|
|
5213
|
+
*
|
|
5214
|
+
* // with column name via `column` method:
|
|
5215
|
+
* sql`${db.table.column('column')} = ${value}`;
|
|
5216
|
+
*
|
|
5217
|
+
* // raw SQL string, not allowed to interpolate values:
|
|
5218
|
+
* sql({ raw: 'random()' });
|
|
5219
|
+
*
|
|
5220
|
+
* // with resulting type and `raw` string:
|
|
5221
|
+
* sql<number>({ raw: 'random()' });
|
|
5222
|
+
*
|
|
5223
|
+
* // with column name and a value in a `raw` string:
|
|
5224
|
+
* sql({
|
|
5225
|
+
* raw: `$$column = $value`,
|
|
5226
|
+
* values: { column: 'columnName', value: 123 },
|
|
5227
|
+
* });
|
|
5228
|
+
*
|
|
5229
|
+
* // combine template literal, column type, and values:
|
|
5230
|
+
* sql`($one + $two) / $one`.type((t) => t.numeric()).values({ one: 1, two: 2 });
|
|
5231
|
+
* ```
|
|
5232
|
+
*
|
|
5233
|
+
* @param args - template literal or an object { raw: string }
|
|
5234
|
+
* @return object that has `type` and `values` methods
|
|
5235
|
+
*/
|
|
5236
|
+
sql<T = unknown>(this: PickQueryColumnTypes, ...args: StaticSQLArgs): RawSQL<QueryColumn<T>, ColumnTypes>;
|
|
5237
|
+
sql<T = unknown>(this: PickQueryColumnTypes, ...args: [DynamicSQLArg]): DynamicRawSQL<QueryColumn<T>, ColumnTypes>;
|
|
5238
|
+
}
|
|
5239
|
+
|
|
5240
|
+
interface WithArgsOptions {
|
|
5241
|
+
columns?: string[] | boolean;
|
|
5242
|
+
materialized?: true;
|
|
5243
|
+
notMaterialized?: true;
|
|
5244
|
+
}
|
|
5245
|
+
interface WithRecursiveOptions extends WithArgsOptions {
|
|
5246
|
+
union?: 'UNION' | 'UNION ALL' | 'INTERSECT' | 'INTERSECT ALL' | 'EXCEPT' | 'EXCEPT ALL';
|
|
5247
|
+
}
|
|
5248
|
+
type WithQueryBuilder<T extends PickQueryWithDataColumnTypes> = {
|
|
5249
|
+
[K in keyof Query]: K extends 'sql' ? SqlMethod<T['columnTypes']>['sql'] : K extends 'relations' ? EmptyObject : K extends 'withData' ? T['withData'] : Query[K];
|
|
5096
5250
|
};
|
|
5097
|
-
type
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
}
|
|
5103
|
-
|
|
5251
|
+
type WithResult<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends PickQueryResult> = {
|
|
5252
|
+
[K in keyof T]: K extends 'withData' ? {
|
|
5253
|
+
[K in keyof T['withData'] | Name]: K extends Name ? {
|
|
5254
|
+
table: Name;
|
|
5255
|
+
shape: Q['result'];
|
|
5256
|
+
} : K extends keyof T['withData'] ? T['withData'][K] : never;
|
|
5257
|
+
} : T[K];
|
|
5258
|
+
};
|
|
5259
|
+
type WithSqlResult<T extends PickQueryWithDataColumnTypes, Name extends string, Shape extends ColumnsShapeBase> = {
|
|
5260
|
+
[K in keyof T]: K extends 'withData' ? {
|
|
5261
|
+
[K in Name | keyof T['withData']]: K extends Name ? {
|
|
5262
|
+
table: Name;
|
|
5263
|
+
shape: Shape;
|
|
5264
|
+
} : K extends keyof T['withData'] ? T['withData'][K] : never;
|
|
5265
|
+
} : T[K];
|
|
5266
|
+
};
|
|
5267
|
+
declare class WithMethods {
|
|
5104
5268
|
/**
|
|
5105
5269
|
* Add Common Table Expression (CTE) to the query.
|
|
5106
5270
|
*
|
|
@@ -5164,73 +5328,113 @@ declare class With {
|
|
|
5164
5328
|
* .join('alias', 'alias.id', 'user.id')
|
|
5165
5329
|
* .select('alias.id');
|
|
5166
5330
|
* ```
|
|
5167
|
-
*
|
|
5168
|
-
* @param args - first argument is an alias for this CTE, other arguments can be column shape, query object, or raw SQL.
|
|
5169
5331
|
*/
|
|
5170
|
-
with<T extends
|
|
5332
|
+
with<T extends PickQueryWithDataColumnTypes, Name extends string, Q>(this: T, name: Name, query: Q | ((q: WithQueryBuilder<T>) => Q)): WithResult<T, Name, Q extends Query ? Q : never>;
|
|
5333
|
+
with<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends Query>(this: T, name: Name, options: WithArgsOptions, query: Q | ((qb: WithQueryBuilder<T>) => Q)): WithResult<T, Name, Q>;
|
|
5334
|
+
withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends Query, Result = WithResult<T, Name, Q>>(this: T, name: Name, base: Q | ((qb: WithQueryBuilder<T>) => Q), recursive: (qb: {
|
|
5335
|
+
[K in keyof Result]: K extends 'result' ? Q['result'] : Result[K];
|
|
5336
|
+
}) => Query): Result;
|
|
5337
|
+
withRecursive<T extends PickQueryWithDataColumnTypes, Name extends string, Q extends Query, Result = WithResult<T, Name, Q>>(this: T, name: Name, options: WithRecursiveOptions, base: Q | ((qb: WithQueryBuilder<T>) => Q), recursive: (qb: {
|
|
5338
|
+
[K in keyof Result]: K extends 'result' ? Q['result'] : Result[K];
|
|
5339
|
+
}) => Query): Result;
|
|
5340
|
+
withSql<T extends PickQueryWithDataColumnTypes, Name extends string, Shape extends ColumnsShapeBase>(this: T, name: Name, options: WithOptions, shape: (t: T['columnTypes']) => Shape, expr: (q: T) => Expression): WithSqlResult<T, Name, Shape>;
|
|
5341
|
+
withSql<T extends PickQueryWithDataColumnTypes, Name extends string, Shape extends ColumnsShapeBase>(this: T, name: Name, shape: (t: T['columnTypes']) => Shape, expr: (q: T) => Expression): WithSqlResult<T, Name, Shape>;
|
|
5171
5342
|
}
|
|
5172
5343
|
|
|
5173
5344
|
type UnionArg<T extends PickQueryResult> = {
|
|
5174
5345
|
result: {
|
|
5175
5346
|
[K in keyof T['result']]: {
|
|
5176
|
-
|
|
5347
|
+
queryType: T['result'][K]['queryType'];
|
|
5177
5348
|
};
|
|
5178
5349
|
};
|
|
5179
|
-
} | Expression;
|
|
5350
|
+
} | ((q: T) => Expression);
|
|
5351
|
+
declare const _queryUnion: <T extends Query>(base: T, args: UnionArg<T>[], k: UnionKind) => T;
|
|
5180
5352
|
declare class Union {
|
|
5181
5353
|
/**
|
|
5182
|
-
* Creates a union query,
|
|
5183
|
-
* If the `wrap` parameter is true, the queries will be individually wrapped in parentheses.
|
|
5354
|
+
* Creates a union query, takes one or more queries or SQL expressions.
|
|
5184
5355
|
*
|
|
5185
5356
|
* ```ts
|
|
5186
|
-
*
|
|
5187
|
-
*
|
|
5188
|
-
*
|
|
5189
|
-
*
|
|
5190
|
-
*
|
|
5191
|
-
*
|
|
5192
|
-
* )
|
|
5357
|
+
* // The first query of the union
|
|
5358
|
+
* db.one
|
|
5359
|
+
* .select('id', 'name')
|
|
5360
|
+
* // add two more queries to the union
|
|
5361
|
+
* .union(
|
|
5362
|
+
* db.two.select('id', 'name'),
|
|
5363
|
+
* (q = q.sql`SELECT id, name FROM "thirdTable"`),
|
|
5364
|
+
* )
|
|
5365
|
+
* // sub-sequent `union` is equivalent to passing multiple queries into a single `union`
|
|
5366
|
+
* .union(db.three.select('id', 'name'));
|
|
5367
|
+
* ```
|
|
5368
|
+
*
|
|
5369
|
+
* `order`, `limit`, `offset` are special, it matters if you place them **before** or **after** the `union`, it also have a meaning to place them before and after.
|
|
5370
|
+
*
|
|
5371
|
+
* ```ts
|
|
5372
|
+
* // order, limit, offset are applied ONLY to 'one'
|
|
5373
|
+
* db.one
|
|
5374
|
+
* .order('x')
|
|
5375
|
+
* .limit(1)
|
|
5376
|
+
* .offset(1)
|
|
5377
|
+
* // 'two' also has order, limit, and offset
|
|
5378
|
+
* .unionAll(db.two.order('y').limit(2).offset(2))
|
|
5379
|
+
* // sets order, limit, offset for all records
|
|
5380
|
+
* .order('z')
|
|
5381
|
+
* .limit(3)
|
|
5382
|
+
* .offset(3);
|
|
5193
5383
|
* ```
|
|
5194
5384
|
*
|
|
5195
|
-
*
|
|
5196
|
-
*
|
|
5385
|
+
* Equivalent SQL:
|
|
5386
|
+
*
|
|
5387
|
+
* ```sql
|
|
5388
|
+
* -- both union parts have their own order, limit, offset
|
|
5389
|
+
* ( SELECT * FROM one ORDER x ASC LIMIT 1 OFFSET 1 )
|
|
5390
|
+
* UNION ALL
|
|
5391
|
+
* ( SELECT * FROM two ORDER y ASC LIMIT 2 OFFSET 2 )
|
|
5392
|
+
* -- order, limit, offset of the whole query
|
|
5393
|
+
* ORDER BY z ASC LIMIT 3 OFFSET 3
|
|
5394
|
+
* ```
|
|
5395
|
+
*
|
|
5396
|
+
* All the listed methods have the same signature, they are only different by SQL keyword:
|
|
5397
|
+
*
|
|
5398
|
+
* - `union` - union of all queries, performs deduplication
|
|
5399
|
+
* - `unionAll` - `union` that allows duplicated rows
|
|
5400
|
+
* - `intersect` - get only rows that are present in all queries
|
|
5401
|
+
* - `intersectAll` - `intersect` that allows duplicated rows
|
|
5402
|
+
* - `except` - get only rows that are in the first query but not in the second
|
|
5403
|
+
* - `exceptAll` - `except` that allows duplicated rows
|
|
5404
|
+
*
|
|
5405
|
+
* @param args - array of queries or SQL expressions
|
|
5197
5406
|
*/
|
|
5198
|
-
union<T extends PickQueryResult>(this: T, args: UnionArg<T>[]
|
|
5407
|
+
union<T extends PickQueryResult>(this: T, ...args: UnionArg<T>[]): T;
|
|
5199
5408
|
/**
|
|
5200
|
-
* Same as
|
|
5409
|
+
* Same as {@link union}, but allows duplicated rows.
|
|
5201
5410
|
*
|
|
5202
|
-
* @param args - array of queries or
|
|
5203
|
-
* @param wrap - provide `true` if you want the queries to be wrapped into parentheses
|
|
5411
|
+
* @param args - array of queries or SQL expressions
|
|
5204
5412
|
*/
|
|
5205
|
-
unionAll<T extends PickQueryResult>(this: T, args: UnionArg<T>[]
|
|
5413
|
+
unionAll<T extends PickQueryResult>(this: T, ...args: UnionArg<T>[]): T;
|
|
5206
5414
|
/**
|
|
5207
|
-
* Same as
|
|
5415
|
+
* Same as {@link union}, but uses a `INTERSECT` SQL keyword instead
|
|
5208
5416
|
*
|
|
5209
|
-
* @param args - array of queries or
|
|
5210
|
-
* @param wrap - provide `true` if you want the queries to be wrapped into parentheses
|
|
5417
|
+
* @param args - array of queries or SQL expressions
|
|
5211
5418
|
*/
|
|
5212
|
-
intersect<T extends PickQueryResult>(this: T, args: UnionArg<T>[]
|
|
5419
|
+
intersect<T extends PickQueryResult>(this: T, ...args: UnionArg<T>[]): T;
|
|
5213
5420
|
/**
|
|
5214
|
-
* Same as
|
|
5421
|
+
* Same as {@link intersect}, but allows duplicated rows.
|
|
5215
5422
|
*
|
|
5216
|
-
* @param args - array of queries or
|
|
5217
|
-
* @param wrap - provide `true` if you want the queries to be wrapped into parentheses
|
|
5423
|
+
* @param args - array of queries or SQL expressions
|
|
5218
5424
|
*/
|
|
5219
|
-
intersectAll<T extends PickQueryResult>(this: T, args: UnionArg<T>[]
|
|
5425
|
+
intersectAll<T extends PickQueryResult>(this: T, ...args: UnionArg<T>[]): T;
|
|
5220
5426
|
/**
|
|
5221
|
-
* Same as
|
|
5427
|
+
* Same as {@link union}, but uses an `EXCEPT` SQL keyword instead
|
|
5222
5428
|
*
|
|
5223
|
-
* @param args - array of queries or
|
|
5224
|
-
* @param wrap - provide `true` if you want the queries to be wrapped into parentheses
|
|
5429
|
+
* @param args - array of queries or SQL expressions
|
|
5225
5430
|
*/
|
|
5226
|
-
except<T extends PickQueryResult>(this: T, args: UnionArg<T>[]
|
|
5431
|
+
except<T extends PickQueryResult>(this: T, ...args: UnionArg<T>[]): T;
|
|
5227
5432
|
/**
|
|
5228
|
-
* Same as
|
|
5433
|
+
* Same as {@link except}, but allows duplicated rows.
|
|
5229
5434
|
*
|
|
5230
|
-
* @param args - array of queries or
|
|
5231
|
-
* @param wrap - provide `true` if you want the queries to be wrapped into parentheses
|
|
5435
|
+
* @param args - array of queries or SQL expressions
|
|
5232
5436
|
*/
|
|
5233
|
-
exceptAll<T extends PickQueryResult>(this: T, args: UnionArg<T>[]
|
|
5437
|
+
exceptAll<T extends PickQueryResult>(this: T, ...args: UnionArg<T>[]): T;
|
|
5234
5438
|
}
|
|
5235
5439
|
|
|
5236
5440
|
type UpdateSelf = {
|
|
@@ -6021,150 +6225,6 @@ declare class QueryUpsertOrCreate {
|
|
|
6021
6225
|
orCreate<T extends UpsertThis, BT extends CreateBelongsToData<T>>(this: T, data: OrCreateArg<T, BT>): UpsertResult<T>;
|
|
6022
6226
|
}
|
|
6023
6227
|
|
|
6024
|
-
declare class SqlMethod<ColumnTypes> {
|
|
6025
|
-
/**
|
|
6026
|
-
* When there is a need to use a piece of raw SQL, use the `sql` exported from the `BaseTable` file, it is also attached to query objects for convenience.
|
|
6027
|
-
*
|
|
6028
|
-
* When selecting a custom SQL, specify a resulting type with `<generic>` syntax:
|
|
6029
|
-
*
|
|
6030
|
-
* ```ts
|
|
6031
|
-
* import { sql } from './baseTable';
|
|
6032
|
-
*
|
|
6033
|
-
* const result: { num: number }[] = await db.table.select({
|
|
6034
|
-
* num: sql<number>`random() * 100`,
|
|
6035
|
-
* });
|
|
6036
|
-
* ```
|
|
6037
|
-
*
|
|
6038
|
-
* In a situation when you want the result to be parsed, such as when returning a timestamp that you want to be parsed into a `Date` object, provide a column type in such a way:
|
|
6039
|
-
*
|
|
6040
|
-
* This example assumes that the `timestamp` column was overridden with `asDate` as shown in [Override column types](/guide/columns-overview#override-column-types).
|
|
6041
|
-
*
|
|
6042
|
-
* ```ts
|
|
6043
|
-
* import { sql } from './baseTable';
|
|
6044
|
-
*
|
|
6045
|
-
* const result: { timestamp: Date }[] = await db.table.select({
|
|
6046
|
-
* timestamp: sql`now()`.type((t) => t.timestamp()),
|
|
6047
|
-
* });
|
|
6048
|
-
* ```
|
|
6049
|
-
*
|
|
6050
|
-
* In some cases such as when using [from](/guide/orm-and-query-builder.html#from), setting column type via callback allows for special `where` operations:
|
|
6051
|
-
*
|
|
6052
|
-
* ```ts
|
|
6053
|
-
* const subQuery = db.someTable.select({
|
|
6054
|
-
* sum: (q) => q.sql`$a + $b`.type((t) => t.decimal()).values({ a: 1, b: 2 }),
|
|
6055
|
-
* });
|
|
6056
|
-
*
|
|
6057
|
-
* // `gt`, `gte`, `min`, `lt`, `lte`, `max` in `where`
|
|
6058
|
-
* // are allowed only for numeric columns:
|
|
6059
|
-
* const result = await db.$from(subQuery).where({ sum: { gte: 5 } });
|
|
6060
|
-
* ```
|
|
6061
|
-
*
|
|
6062
|
-
* Many query methods have a version suffixed with `Sql`, you can pass an SQL template literal directly to these methods.
|
|
6063
|
-
* These methods are: `whereSql`, `whereNotSql`, `orderSql`, `havingSql`, `fromSql`, `findBySql`.
|
|
6064
|
-
*
|
|
6065
|
-
* ```ts
|
|
6066
|
-
* await db.table.whereSql`"someValue" = random() * 100`;
|
|
6067
|
-
* ```
|
|
6068
|
-
*
|
|
6069
|
-
* Interpolating values in template literals is completely safe:
|
|
6070
|
-
*
|
|
6071
|
-
* ```ts
|
|
6072
|
-
* // get value from user-provided params
|
|
6073
|
-
* const { value } = req.params;
|
|
6074
|
-
*
|
|
6075
|
-
* // SQL injection is prevented by a library, this is safe:
|
|
6076
|
-
* await db.table.whereSql`column = ${value}`;
|
|
6077
|
-
* ```
|
|
6078
|
-
*
|
|
6079
|
-
* In the example above, TS cannot check if the table has `column` column, or if there are joined tables that have such column which will lead to error.
|
|
6080
|
-
* Instead, use the [column](/guide/sql-expressions#column) or [ref](/guide/sql-expressions#ref) to reference a column:
|
|
6081
|
-
*
|
|
6082
|
-
* ```ts
|
|
6083
|
-
* // ids will be prefixed with proper table names, no ambiguity:
|
|
6084
|
-
* db.table.join(db.otherTable, 'id', 'otherId').where`
|
|
6085
|
-
* ${db.table.column('id')} = 1 AND
|
|
6086
|
-
* ${db.otherTable.ref('id')} = 2
|
|
6087
|
-
* `;
|
|
6088
|
-
* ```
|
|
6089
|
-
*
|
|
6090
|
-
* SQL can be passed with a simple string, it's important to note that this is not safe to interpolate values in it.
|
|
6091
|
-
*
|
|
6092
|
-
* ```ts
|
|
6093
|
-
* import { sql } from './baseTable';
|
|
6094
|
-
*
|
|
6095
|
-
* // no interpolation is okay
|
|
6096
|
-
* await db.table.where(sql({ raw: 'column = random() * 100' }));
|
|
6097
|
-
*
|
|
6098
|
-
* // get value from user-provided params
|
|
6099
|
-
* const { value } = req.params;
|
|
6100
|
-
*
|
|
6101
|
-
* // this is NOT safe, SQL injection is possible:
|
|
6102
|
-
* await db.table.where(sql({ raw: `column = random() * ${value}` }));
|
|
6103
|
-
* ```
|
|
6104
|
-
*
|
|
6105
|
-
* To inject values into `sql({ raw: '...' })` SQL strings, denote it with `$` in the string and provide `values` object.
|
|
6106
|
-
*
|
|
6107
|
-
* Use `$$` to provide column or/and table name (`column` or `ref` are preferable). Column names will be quoted so don't quote them manually.
|
|
6108
|
-
*
|
|
6109
|
-
* ```ts
|
|
6110
|
-
* import { sql } from './baseTable';
|
|
6111
|
-
*
|
|
6112
|
-
* // get value from user-provided params
|
|
6113
|
-
* const { value } = req.params;
|
|
6114
|
-
*
|
|
6115
|
-
* // this is SAFE, SQL injection are prevented:
|
|
6116
|
-
* await db.table.where(
|
|
6117
|
-
* sql<boolean>({
|
|
6118
|
-
* raw: '$$column = random() * $value',
|
|
6119
|
-
* values: {
|
|
6120
|
-
* column: 'someTable.someColumn', // or simply 'column'
|
|
6121
|
-
* one: value,
|
|
6122
|
-
* two: 123,
|
|
6123
|
-
* },
|
|
6124
|
-
* }),
|
|
6125
|
-
* );
|
|
6126
|
-
* ```
|
|
6127
|
-
*
|
|
6128
|
-
* Summarizing:
|
|
6129
|
-
*
|
|
6130
|
-
* ```ts
|
|
6131
|
-
* import { sql } from './baseTable';
|
|
6132
|
-
*
|
|
6133
|
-
* // simplest form:
|
|
6134
|
-
* sql`key = ${value}`;
|
|
6135
|
-
*
|
|
6136
|
-
* // with resulting type:
|
|
6137
|
-
* sql<boolean>`key = ${value}`;
|
|
6138
|
-
*
|
|
6139
|
-
* // with column type for select:
|
|
6140
|
-
* sql`key = ${value}`.type((t) => t.boolean());
|
|
6141
|
-
*
|
|
6142
|
-
* // with column name via `column` method:
|
|
6143
|
-
* sql`${db.table.column('column')} = ${value}`;
|
|
6144
|
-
*
|
|
6145
|
-
* // raw SQL string, not allowed to interpolate values:
|
|
6146
|
-
* sql({ raw: 'random()' });
|
|
6147
|
-
*
|
|
6148
|
-
* // with resulting type and `raw` string:
|
|
6149
|
-
* sql<number>({ raw: 'random()' });
|
|
6150
|
-
*
|
|
6151
|
-
* // with column name and a value in a `raw` string:
|
|
6152
|
-
* sql({
|
|
6153
|
-
* raw: `$$column = $value`,
|
|
6154
|
-
* values: { column: 'columnName', value: 123 },
|
|
6155
|
-
* });
|
|
6156
|
-
*
|
|
6157
|
-
* // combine template literal, column type, and values:
|
|
6158
|
-
* sql`($one + $two) / $one`.type((t) => t.numeric()).values({ one: 1, two: 2 });
|
|
6159
|
-
* ```
|
|
6160
|
-
*
|
|
6161
|
-
* @param args - template literal or an object { raw: string }
|
|
6162
|
-
* @return object that has `type` and `values` methods
|
|
6163
|
-
*/
|
|
6164
|
-
sql<T = unknown>(this: PickQueryColumnTypes, ...args: StaticSQLArgs): RawSQL<QueryColumn<T>, ColumnTypes>;
|
|
6165
|
-
sql<T = unknown>(this: PickQueryColumnTypes, ...args: [DynamicSQLArg]): DynamicRawSQL<QueryColumn<T>, ColumnTypes>;
|
|
6166
|
-
}
|
|
6167
|
-
|
|
6168
6228
|
type QueryTransformFn<T extends Query> = (input: T['then'] extends QueryThen<infer Data> ? Data : never) => unknown;
|
|
6169
6229
|
type QueryTransform<T extends QueryBase, Data> = {
|
|
6170
6230
|
[K in keyof T]: K extends 'returnType' ? 'valueOrThrow' : K extends 'result' ? {
|
|
@@ -6277,7 +6337,7 @@ declare const _queryExec: <T extends Query>(q: T) => never;
|
|
|
6277
6337
|
declare const _queryFindBy: <T extends QueryBase<EmptyObject>>(q: T, args: WhereArg<T>[]) => SetQueryReturnsOne<WhereResult<T>>;
|
|
6278
6338
|
declare const _queryFindByOptional: <T extends QueryBase<EmptyObject>>(q: T, args: WhereArg<T>[]) => SetQueryReturnsOneOptional<WhereResult<T>>;
|
|
6279
6339
|
declare const _queryRows: <T extends Query>(q: T) => SetQueryReturnsRows<T>;
|
|
6280
|
-
interface QueryMethods<ColumnTypes> extends AsMethods, AggregateMethods, Select,
|
|
6340
|
+
interface QueryMethods<ColumnTypes> extends AsMethods, AggregateMethods, Select, FromMethods, Join, WithMethods, Union, JsonModifiers, JsonMethods, Create, Update, Delete, Transaction, For, Where, SearchMethods, Clear, Having, QueryLog, QueryHooks, QueryUpsertOrCreate, QueryGet, MergeQueryMethods, SqlMethod<ColumnTypes>, TransformMethods, ScopeMethods, SoftDeleteMethods, ExpressionMethods {
|
|
6281
6341
|
}
|
|
6282
6342
|
declare class QueryMethods<ColumnTypes> {
|
|
6283
6343
|
/**
|
|
@@ -6928,6 +6988,8 @@ interface PickQueryColumnTypes {
|
|
|
6928
6988
|
}
|
|
6929
6989
|
interface PickQueryMetaResultRelationsWindowsColumnTypes extends PickQueryMetaResultRelationsWindows, PickQueryColumnTypes {
|
|
6930
6990
|
}
|
|
6991
|
+
interface PickQueryWithDataColumnTypes extends PickQueryWithData, PickQueryColumnTypes {
|
|
6992
|
+
}
|
|
6931
6993
|
interface PickQueryMetaTable extends PickQueryMeta, PickQueryTable {
|
|
6932
6994
|
}
|
|
6933
6995
|
interface PickQueryMetaTableShape extends PickQueryMetaTable, PickQueryShape {
|
|
@@ -7106,12 +7168,6 @@ type SetQueryTableAlias<T extends PickQueryMetaTableShape, As extends string> =
|
|
|
7106
7168
|
} : T['meta'][K];
|
|
7107
7169
|
} : T[K];
|
|
7108
7170
|
};
|
|
7109
|
-
type SetQueryWith<T, WithData> = {
|
|
7110
|
-
[K in keyof T]: K extends 'withData' ? WithData : T[K];
|
|
7111
|
-
};
|
|
7112
|
-
type AddQueryWith<T extends PickQueryWithData, With extends WithDataItem> = SetQueryWith<T, {
|
|
7113
|
-
[K in keyof T['withData'] | With['table']]: K extends With['table'] ? With : K extends keyof T['withData'] ? T['withData'][K] : never;
|
|
7114
|
-
}>;
|
|
7115
7171
|
interface QueryOrExpression<T> {
|
|
7116
7172
|
result: {
|
|
7117
7173
|
value: QueryColumn<T>;
|
|
@@ -7780,4 +7836,4 @@ type CopyResult<T extends PickQueryMeta> = SetQueryKind<T, 'copy'>;
|
|
|
7780
7836
|
*/
|
|
7781
7837
|
declare function copyTableData<T extends PickQueryMetaShape>(query: T, arg: CopyArg<T>): CopyResult<T>;
|
|
7782
7838
|
|
|
7783
|
-
export { Adapter, AdapterConfig, AdapterOptions, AddQueryDefaults, AddQuerySelect,
|
|
7839
|
+
export { Adapter, AdapterConfig, AdapterOptions, AddQueryDefaults, AddQuerySelect, AfterHook, AggregateMethods, AggregateOptions, AliasOrTable, ArrayColumn, ArrayColumnValue, ArrayData, AsMethods, AsQueryArg, BaseOperators, BigIntColumn, BigSerialColumn, BitColumn, BitVaryingColumn, BooleanColumn, BooleanQueryColumn, BoxColumn, ByteaColumn, CharColumn, CidrColumn, CircleColumn, CitextColumn, Clear, ClearStatement, CloneSelfKeys, ColumnData, ColumnExpression, ColumnFromDbParams, ColumnInfoQueryData, ColumnOperators, ColumnRefExpression, ColumnType, ColumnsByType, ColumnsShape, ColumnsShapeToNullableObject, ColumnsShapeToObject, ColumnsShapeToObjectArray, ColumnsShapeToPluck, CommonQueryData, ComputedColumnsBase, CopyOptions, CopyQueryData, Create, CreateBelongsToData, CreateColumn, CreateCtx, CreateData, CreateKind, CreateMethodsNames, CreateRelationsData, CreateRelationsDataOmittingFKeys, CreateSelf, CustomTypeColumn, DateBaseColumn, DateColumn, DateColumnInput, DateTimeBaseClass, DateTimeTzBaseClass, Db, DbDomainArg, DbDomainArgRecord, DbExtension, DbOptions, DbResult, DbSharedOptions, DbTableConstructor, DbTableOptionScopes, DbTableOptions, DecimalColumn, DecimalColumnData, DefaultColumnTypes, DefaultSchemaConfig, Delete, DeleteArgs, DeleteMethodsNames, DeleteQueryData, DeleteResult, DomainColumn, DoublePrecisionColumn, DynamicRawSQL, EnumColumn, ExpressionMethods, ExpressionOutput, FnExpression, FnExpressionArgs, FnExpressionArgsPairs, FnExpressionArgsValue, For, FromArg, FromMethods, FromQuerySelf, FromResult, GetArg, GetColumnInfo, GetQueryResult, GetResult, GetResultOptional, GetStringArg, GroupArg, Having, HavingItem, HookAction, HookSelect, IdentityColumn, InetColumn, InsertQueryData, IntegerBaseColumn, IntegerColumn, IntervalColumn, IsolationLevel, JSONColumn, JSONTextColumn, Join, JoinArgs, JoinCallback, JoinFirstArg, JoinItem, JoinItemArgs, JoinLateralCallback, JoinLateralItem, JoinLateralResult, JoinOverrides, JoinQueryBuilder, JoinQueryMethod, JoinResult, JoinedParsers, JoinedShapes, JsonItem, JsonMethods, JsonModifiers, LimitedTextBaseColumn, LineColumn, LsegColumn, MacAddr8Column, MacAddrColumn, MapTableScopesOption, MergeQuery, MergeQueryMethods, MoneyColumn, MoreThanOneRowError, NoPrimaryKeyOption, NotFoundError, NumberAsStringBaseColumn, NumberBaseColumn, NumberColumnData, OnConflictMerge, OnConflictQueryBuilder, OnConflictSet, OnConflictTarget, OnMethods, Operator, Operators, OperatorsAny, OperatorsArray, OperatorsBoolean, OperatorsDate, OperatorsJson, OperatorsNumber, OperatorsText, OperatorsTime, OrCreateArg, OrExpression, OrchidOrmError, OrchidOrmInternalError, OrderArg, OrderArgSelf, OrderArgs, OrderItem, OrderTsQueryConfig, Over, PathColumn, PickColumnData, PickQueryBaseQuery, PickQueryColumnTypes, PickQueryDataShapeAndJoinedShapes, PickQueryInternal, PickQueryMetaRelations, PickQueryMetaResultRelations, PickQueryMetaResultRelationsWindows, PickQueryMetaResultRelationsWindowsColumnTypes, PickQueryMetaResultRelationsWithDataReturnType, PickQueryMetaResultRelationsWithDataReturnTypeShape, PickQueryMetaResultReturnTypeWithDataWindows, PickQueryMetaResultReturnTypeWithDataWindowsTable, PickQueryMetaShapeRelationsWithData, PickQueryMetaTable, PickQueryMetaTableShape, PickQueryMetaTableShapeReturnTypeWithData, PickQueryMetaWithData, PickQueryQ, PickQueryQAndBaseQuery, PickQueryQAndInternal, PickQueryRelations, PickQueryRelationsWithData, PickQueryShapeResultSinglePrimaryKey, PickQueryShapeSinglePrimaryKey, PickQuerySinglePrimaryKey, PickQueryWindows, PickQueryWithData, PickQueryWithDataColumnTypes, PointColumn, PolygonColumn, Query, QueryAfterHook, QueryArraysResult, QueryBase, QueryBaseThen, QueryBeforeHook, QueryData, QueryDataFromItem, QueryDataJoinTo, QueryDefaultReturnData, QueryError, QueryErrorName, QueryGet, QueryGetSelf, QueryHelperResult, QueryHookSelect, QueryHooks, QueryInternal, QueryLog, QueryLogObject, QueryLogOptions, QueryLogger, QueryMetaHasSelect, QueryMetaHasWhere, QueryMethods, QueryOrExpression, QueryOrExpressionBooleanOrNullResult, QueryResult, QueryReturnsAll, QueryScopeData, QueryScopes, QuerySourceItem, QueryTransform, QueryTransformFn, QueryUpsertOrCreate, QueryWithComputed, QueryWithTable, RawSQL, RealColumn, RecordOfColumnsShapeBase, RefExpression, RelationConfigBase, RelationConfigDataForCreate, RelationJoinQuery, RelationQuery, RelationQueryBase, RelationsBase, SearchArg, SearchMethods, SearchWeight, SearchWeightRecord, Select, SelectArg, SelectAs, SelectItem, SelectQueryData, SelectSubQueryResult, SelectableFromShape, SelectableOfType, SelectableOrExpression, SelectableOrExpressionOfType, SerialColumn, SerialColumnData, SetQueryKind, SetQueryKindResult, SetQueryReturnsAll, SetQueryReturnsAllKind, SetQueryReturnsAllKindResult, SetQueryReturnsColumnInfo, SetQueryReturnsColumnKind, SetQueryReturnsColumnKindResult, SetQueryReturnsColumnOptional, SetQueryReturnsColumnOrThrow, SetQueryReturnsOne, SetQueryReturnsOneKind, SetQueryReturnsOneKindResult, SetQueryReturnsOneOptional, SetQueryReturnsPluck, SetQueryReturnsPluckColumn, SetQueryReturnsPluckColumnKind, SetQueryReturnsPluckColumnKindResult, SetQueryReturnsRowCount, SetQueryReturnsRows, SetQueryReturnsValueOptional, SetQueryReturnsValueOrThrow, SetQueryReturnsVoid, SetQueryReturnsVoidKind, SetQueryTableAlias, ShapeColumnPrimaryKeys, ShapeUniqueColumns, SimpleJoinItem, SimpleJoinItemNonSubQueryArgs, SmallIntColumn, SmallSerialColumn, SortDir, SqlFn, SqlMethod, StringColumn$1 as StringColumn, TableData, TableDataFn, TableDataInput, TableDataItem, TableDataItemsUniqueColumnTuples, TableDataItemsUniqueColumns, TableDataItemsUniqueConstraints, TableDataMethods, TextBaseColumn, TextColumn, TextColumnData, Then, TimeColumn, TimestampColumn, TimestampTZColumn, ToSQLCtx, ToSQLOptions, ToSQLQuery, Transaction, TransactionAdapter, TransactionOptions, TransformMethods, TruncateQueryData, TsQueryColumn, TsVectorColumn, TypeParsers, UUIDColumn, UnhandledTypeError, Union, UnionArg, UnionItem, UnionKind, UnionSet, UniqueConstraints, UniqueQueryTypeOrExpression, UniqueTableDataItem, UnknownColumn, Update, UpdateArg, UpdateCtx, UpdateCtxCollect, UpdateData, UpdateQueryData, UpdateQueryDataItem, UpdateQueryDataObject, UpdateSelf, UpdatedAtDataInjector, UpsertArg, UpsertResult, UpsertThis, VarCharColumn, VirtualColumn, Where, WhereArg, WhereArgs, WhereInArg, WhereInColumn, WhereInItem, WhereInValues, WhereItem, WhereJsonPathEqualsItem, WhereNotArgs, WhereOnItem, WhereOnJoinItem, WhereQueryBuilder, WhereResult, WhereSearchItem, WhereSearchResult, WindowArg, WindowArgDeclaration, WindowDeclaration, WindowItem, WithArgsOptions, WithDataBase, WithDataItem, WithDataItems, WithItem, WithMethods, WithOptions, WithQueryBuilder, WithRecursiveOptions, WithResult, WithSqlResult, WrapQueryArg, XMLColumn, _initQueryBuilder, _queryAfterSaveCommit, _queryAll, _queryAs, _queryChangeCounter, _queryCreate, _queryCreateFrom, _queryCreateMany, _queryCreateManyFrom, _queryCreateManyRaw, _queryCreateRaw, _queryDefaults, _queryDelete, _queryExec, _queryFindBy, _queryFindByOptional, _queryGet, _queryGetOptional, _queryHookAfterCreate, _queryHookAfterCreateCommit, _queryHookAfterDelete, _queryHookAfterDeleteCommit, _queryHookAfterQuery, _queryHookAfterSave, _queryHookAfterUpdate, _queryHookAfterUpdateCommit, _queryHookBeforeCreate, _queryHookBeforeDelete, _queryHookBeforeQuery, _queryHookBeforeSave, _queryHookBeforeUpdate, _queryInsert, _queryInsertFrom, _queryInsertMany, _queryInsertManyFrom, _queryInsertManyRaw, _queryInsertRaw, _queryJoinOn, _queryJoinOnJsonPathEquals, _queryJoinOrOn, _queryOr, _queryOrNot, _queryRows, _querySelect, _queryTake, _queryTakeOptional, _queryUnion, _queryUpdate, _queryUpdateOrThrow, _queryUpdateRaw, _queryWhere, _queryWhereExists, _queryWhereIn, _queryWhereNot, _queryWhereNotSql, _queryWhereSql, addComputedColumns, addParserForRawExpression, addParserForSelectItem, addQueryOn, anyShape, checkIfASimpleQuery, cloneQuery, cloneQueryBaseUnscoped, columnCheckToCode, columnCode, columnForeignKeysToCode, columnIndexesToCode, columnsShapeToCode, constraintInnerToCode, constraintToCode, copyTableData, countSelect, createDb, defaultSchemaConfig, extendQuery, foreignKeyArgumentToCode, getClonedQueryData, getColumnInfo, getColumnTypes, getPrimaryKeys, getQueryAs, getShapeFromSelect, handleResult, identityToCode, indexInnerToCode, indexToCode, instantiateColumn, isDefaultTimeStamp, isQueryReturnsAll, isSelectingCount, joinSubQuery, logColors, logParamToLogObject, makeColumnTypes, makeColumnsByType, makeFnExpression, makeRegexToFindInSql, makeSQL, parseRecord, parseResult, parseTableData, parseTableDataInput, primaryKeyInnerToCode, processSelectArg, pushLimitSQL, pushQueryArray, pushQueryOn, pushQueryOrOn, pushQueryValue, pushTableDataCode, queryFrom, queryFromSql, queryJson, queryMethodByReturnType, queryTypeWithLimitOne, queryWrap, quote, quoteString, raw, referencesArgsToCode, resolveSubQueryCallback, saveSearchAlias, setParserForSelectedString, setQueryObjectValue, setQueryOperators, simplifyColumnDefault, sqlFn, sqlQueryArgsToExpression, tableDataMethods, templateLiteralToSQL, testTransaction, throwIfNoWhere, toSQL, toSQLCacheKey };
|