@mikro-orm/knex 7.0.0-dev.0 → 7.0.0-dev.10
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/AbstractSqlConnection.d.ts +2 -2
- package/AbstractSqlConnection.js +36 -31
- package/AbstractSqlDriver.d.ts +14 -12
- package/AbstractSqlDriver.js +198 -186
- package/AbstractSqlPlatform.d.ts +4 -4
- package/AbstractSqlPlatform.js +17 -21
- package/PivotCollectionPersister.d.ts +1 -1
- package/PivotCollectionPersister.js +5 -8
- package/SqlEntityManager.d.ts +4 -3
- package/SqlEntityManager.js +2 -6
- package/SqlEntityRepository.d.ts +2 -2
- package/SqlEntityRepository.js +2 -6
- package/dialects/index.d.ts +4 -4
- package/dialects/index.js +4 -20
- package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +1 -1
- package/dialects/mssql/MsSqlNativeQueryBuilder.js +29 -29
- package/dialects/mssql/index.d.ts +1 -1
- package/dialects/mssql/index.js +1 -17
- package/dialects/mysql/MySqlExceptionConverter.js +16 -19
- package/dialects/mysql/MySqlNativeQueryBuilder.d.ts +1 -1
- package/dialects/mysql/MySqlNativeQueryBuilder.js +13 -17
- package/dialects/mysql/MySqlPlatform.d.ts +10 -6
- package/dialects/mysql/MySqlPlatform.js +30 -20
- package/dialects/mysql/MySqlSchemaHelper.d.ts +5 -5
- package/dialects/mysql/MySqlSchemaHelper.js +8 -12
- package/dialects/mysql/index.d.ts +4 -4
- package/dialects/mysql/index.js +4 -20
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.d.ts +1 -1
- package/dialects/postgresql/PostgreSqlNativeQueryBuilder.js +2 -6
- package/dialects/postgresql/index.d.ts +1 -1
- package/dialects/postgresql/index.js +1 -17
- package/dialects/sqlite/BaseSqliteConnection.d.ts +2 -2
- package/dialects/sqlite/BaseSqliteConnection.js +14 -12
- package/dialects/sqlite/BaseSqlitePlatform.d.ts +4 -5
- package/dialects/sqlite/BaseSqlitePlatform.js +11 -19
- package/dialects/sqlite/SqliteExceptionConverter.js +16 -19
- package/dialects/sqlite/SqliteNativeQueryBuilder.d.ts +1 -1
- package/dialects/sqlite/SqliteNativeQueryBuilder.js +2 -6
- package/dialects/sqlite/SqliteSchemaHelper.d.ts +5 -5
- package/dialects/sqlite/SqliteSchemaHelper.js +22 -26
- package/dialects/sqlite/index.d.ts +5 -5
- package/dialects/sqlite/index.js +5 -21
- package/index.d.ts +11 -11
- package/index.js +13 -34
- package/package.json +7 -16
- package/query/ArrayCriteriaNode.d.ts +2 -2
- package/query/ArrayCriteriaNode.js +2 -6
- package/query/CriteriaNode.d.ts +1 -1
- package/query/CriteriaNode.js +25 -33
- package/query/CriteriaNodeFactory.d.ts +1 -1
- package/query/CriteriaNodeFactory.js +17 -21
- package/query/NativeQueryBuilder.d.ts +2 -2
- package/query/NativeQueryBuilder.js +33 -37
- package/query/ObjectCriteriaNode.d.ts +2 -2
- package/query/ObjectCriteriaNode.js +43 -43
- package/query/QueryBuilder.d.ts +17 -15
- package/query/QueryBuilder.js +204 -193
- package/query/QueryBuilderHelper.d.ts +4 -4
- package/query/QueryBuilderHelper.js +86 -96
- package/query/ScalarCriteriaNode.d.ts +2 -2
- package/query/ScalarCriteriaNode.js +12 -16
- package/query/enums.js +4 -7
- package/query/index.d.ts +9 -9
- package/query/index.js +9 -25
- package/schema/DatabaseSchema.d.ts +3 -3
- package/schema/DatabaseSchema.js +7 -11
- package/schema/DatabaseTable.d.ts +3 -3
- package/schema/DatabaseTable.js +44 -33
- package/schema/SchemaComparator.d.ts +4 -4
- package/schema/SchemaComparator.js +15 -19
- package/schema/SchemaHelper.d.ts +5 -5
- package/schema/SchemaHelper.js +22 -26
- package/schema/SqlSchemaGenerator.d.ts +4 -4
- package/schema/SqlSchemaGenerator.js +23 -36
- package/schema/index.d.ts +5 -5
- package/schema/index.js +5 -21
- package/typings.d.ts +7 -4
- package/typings.js +1 -2
- package/index.mjs +0 -232
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const core_1 = require("@mikro-orm/core");
|
|
5
|
-
const CriteriaNode_1 = require("./CriteriaNode");
|
|
6
|
-
const enums_1 = require("./enums");
|
|
1
|
+
import { ALIAS_REPLACEMENT, QueryFlag, raw, RawQueryFragment, ReferenceKind, Utils, } from '@mikro-orm/core';
|
|
2
|
+
import { CriteriaNode } from './CriteriaNode.js';
|
|
3
|
+
import { JoinType, QueryType } from './enums.js';
|
|
7
4
|
/**
|
|
8
5
|
* @internal
|
|
9
6
|
*/
|
|
10
|
-
class ObjectCriteriaNode extends
|
|
7
|
+
export class ObjectCriteriaNode extends CriteriaNode {
|
|
11
8
|
process(qb, options) {
|
|
12
9
|
const nestedAlias = qb.getAliasForJoinPath(this.getPath(), options);
|
|
13
10
|
const ownerAlias = options?.alias || qb.alias;
|
|
@@ -18,7 +15,7 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
18
15
|
}
|
|
19
16
|
if (this.shouldAutoJoin(qb, nestedAlias)) {
|
|
20
17
|
if (keys.some(k => ['$some', '$none', '$every'].includes(k))) {
|
|
21
|
-
if (![
|
|
18
|
+
if (![ReferenceKind.MANY_TO_MANY, ReferenceKind.ONE_TO_MANY].includes(this.prop.kind)) {
|
|
22
19
|
// ignore collection operators when used on a non-relational property - this can happen when they get into
|
|
23
20
|
// populateWhere via `infer` on m:n properties with select-in strategy
|
|
24
21
|
if (this.parent?.parent) { // we validate only usage on top level
|
|
@@ -27,10 +24,10 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
27
24
|
throw new Error(`Collection operators can be used only inside a collection property context, but it was used for ${this.getPath()}.`);
|
|
28
25
|
}
|
|
29
26
|
const $and = [];
|
|
30
|
-
const knownKey = [
|
|
27
|
+
const knownKey = [ReferenceKind.SCALAR, ReferenceKind.MANY_TO_ONE, ReferenceKind.EMBEDDED].includes(this.prop.kind) || (this.prop.kind === ReferenceKind.ONE_TO_ONE && this.prop.owner);
|
|
31
28
|
const parentMeta = this.metadata.find(this.parent.entityName);
|
|
32
29
|
const primaryKeys = parentMeta.primaryKeys.map(pk => {
|
|
33
|
-
return [
|
|
30
|
+
return [QueryType.SELECT, QueryType.COUNT].includes(qb.type) ? `${knownKey ? alias : ownerAlias}.${pk}` : pk;
|
|
34
31
|
});
|
|
35
32
|
for (const key of keys) {
|
|
36
33
|
if (!['$some', '$none', '$every'].includes(key)) {
|
|
@@ -50,7 +47,7 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
50
47
|
}
|
|
51
48
|
const op = key === '$some' ? '$in' : '$nin';
|
|
52
49
|
$and.push({
|
|
53
|
-
[
|
|
50
|
+
[Utils.getPrimaryKeyHash(primaryKeys)]: { [op]: sub.getNativeQuery().toRaw() },
|
|
54
51
|
});
|
|
55
52
|
}
|
|
56
53
|
if ($and.length === 1) {
|
|
@@ -58,13 +55,13 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
58
55
|
}
|
|
59
56
|
return { $and };
|
|
60
57
|
}
|
|
61
|
-
alias = this.autoJoin(qb, ownerAlias);
|
|
58
|
+
alias = this.autoJoin(qb, ownerAlias, options);
|
|
62
59
|
}
|
|
63
60
|
return keys.reduce((o, field) => {
|
|
64
61
|
const childNode = this.payload[field];
|
|
65
62
|
const payload = childNode.process(qb, { ...options, alias: this.prop ? alias : ownerAlias });
|
|
66
|
-
const operator =
|
|
67
|
-
const isRawField =
|
|
63
|
+
const operator = Utils.isOperator(field);
|
|
64
|
+
const isRawField = RawQueryFragment.isKnownFragment(field);
|
|
68
65
|
// we need to keep the prefixing for formulas otherwise we would lose aliasing context when nesting inside group operators
|
|
69
66
|
const virtual = childNode.prop?.persist === false && !childNode.prop?.formula;
|
|
70
67
|
// if key is missing, we are inside group operator and we need to prefix with alias
|
|
@@ -78,11 +75,11 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
78
75
|
this.inlineCondition(childNode.renameFieldToPK(qb), o, payload);
|
|
79
76
|
}
|
|
80
77
|
else if (isRawField) {
|
|
81
|
-
const rawField =
|
|
82
|
-
o[
|
|
78
|
+
const rawField = RawQueryFragment.getKnownFragment(field);
|
|
79
|
+
o[raw(rawField.sql.replaceAll(ALIAS_REPLACEMENT, alias), rawField.params)] = payload;
|
|
83
80
|
}
|
|
84
|
-
else if (primaryKey || virtual || operator || field.includes('.') || ![
|
|
85
|
-
this.inlineCondition(field.replaceAll(
|
|
81
|
+
else if (primaryKey || virtual || operator || field.includes('.') || ![QueryType.SELECT, QueryType.COUNT].includes(qb.type)) {
|
|
82
|
+
this.inlineCondition(field.replaceAll(ALIAS_REPLACEMENT, alias), o, payload);
|
|
86
83
|
}
|
|
87
84
|
else {
|
|
88
85
|
this.inlineCondition(`${alias}.${field}`, o, payload);
|
|
@@ -112,21 +109,21 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
112
109
|
});
|
|
113
110
|
}
|
|
114
111
|
shouldInline(payload) {
|
|
115
|
-
const customExpression =
|
|
116
|
-
const scalar =
|
|
117
|
-
const operator =
|
|
118
|
-
return !!this.prop && this.prop.kind !==
|
|
112
|
+
const customExpression = RawQueryFragment.isKnownFragment(this.key);
|
|
113
|
+
const scalar = Utils.isPrimaryKey(payload) || payload instanceof RegExp || payload instanceof Date || customExpression;
|
|
114
|
+
const operator = Utils.isObject(payload) && Object.keys(payload).every(k => Utils.isOperator(k, false));
|
|
115
|
+
return !!this.prop && this.prop.kind !== ReferenceKind.SCALAR && !scalar && !operator;
|
|
119
116
|
}
|
|
120
117
|
getChildKey(k, prop, childAlias, alias) {
|
|
121
118
|
const idx = prop.referencedPKs.indexOf(k);
|
|
122
|
-
return idx !== -1 && !childAlias && ![
|
|
119
|
+
return idx !== -1 && !childAlias && ![ReferenceKind.ONE_TO_MANY, ReferenceKind.MANY_TO_MANY].includes(prop.kind)
|
|
123
120
|
? this.aliased(prop.joinColumns[idx], alias)
|
|
124
121
|
: k;
|
|
125
122
|
}
|
|
126
123
|
inlineArrayChildPayload(obj, payload, k, prop, childAlias, alias) {
|
|
127
124
|
const key = this.getChildKey(k, prop, childAlias);
|
|
128
125
|
const value = payload.map((child) => Object.keys(child).reduce((inner, childKey) => {
|
|
129
|
-
const key = (this.isPrefixed(childKey) ||
|
|
126
|
+
const key = (this.isPrefixed(childKey) || Utils.isOperator(childKey)) ? childKey : this.aliased(childKey, childAlias);
|
|
130
127
|
inner[key] = child[childKey];
|
|
131
128
|
return inner;
|
|
132
129
|
}, {}));
|
|
@@ -135,19 +132,19 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
135
132
|
inlineChildPayload(o, payload, field, alias, childAlias) {
|
|
136
133
|
const prop = this.metadata.find(this.entityName).properties[field];
|
|
137
134
|
for (const k of Object.keys(payload)) {
|
|
138
|
-
if (
|
|
135
|
+
if (Utils.isOperator(k, false)) {
|
|
139
136
|
const tmp = payload[k];
|
|
140
137
|
delete payload[k];
|
|
141
138
|
o[this.aliased(field, alias)] = { [k]: tmp, ...o[this.aliased(field, alias)] };
|
|
142
139
|
}
|
|
143
|
-
else if (
|
|
140
|
+
else if (Utils.isGroupOperator(k) && Array.isArray(payload[k])) {
|
|
144
141
|
this.inlineArrayChildPayload(o, payload[k], k, prop, childAlias, alias);
|
|
145
142
|
}
|
|
146
|
-
else if (this.isPrefixed(k) ||
|
|
143
|
+
else if (this.isPrefixed(k) || Utils.isOperator(k) || !childAlias) {
|
|
147
144
|
const key = this.getChildKey(k, prop, childAlias, alias);
|
|
148
145
|
this.inlineCondition(key, o, payload[k]);
|
|
149
146
|
}
|
|
150
|
-
else if (
|
|
147
|
+
else if (RawQueryFragment.isKnownFragment(k)) {
|
|
151
148
|
o[k] = payload[k];
|
|
152
149
|
}
|
|
153
150
|
else {
|
|
@@ -160,7 +157,7 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
160
157
|
o[key] = value;
|
|
161
158
|
return;
|
|
162
159
|
}
|
|
163
|
-
/*
|
|
160
|
+
/* v8 ignore next 4 */
|
|
164
161
|
if (key === '$and') {
|
|
165
162
|
o.$and.push({ [key]: value });
|
|
166
163
|
return;
|
|
@@ -182,41 +179,44 @@ class ObjectCriteriaNode extends CriteriaNode_1.CriteriaNode {
|
|
|
182
179
|
return true;
|
|
183
180
|
}
|
|
184
181
|
const meta = this.metadata.find(this.entityName);
|
|
185
|
-
const embeddable = this.prop.kind ===
|
|
186
|
-
const knownKey = [
|
|
187
|
-
const operatorKeys = knownKey && keys.every(key =>
|
|
182
|
+
const embeddable = this.prop.kind === ReferenceKind.EMBEDDED;
|
|
183
|
+
const knownKey = [ReferenceKind.SCALAR, ReferenceKind.MANY_TO_ONE, ReferenceKind.EMBEDDED].includes(this.prop.kind) || (this.prop.kind === ReferenceKind.ONE_TO_ONE && this.prop.owner);
|
|
184
|
+
const operatorKeys = knownKey && keys.every(key => Utils.isOperator(key, false));
|
|
188
185
|
const primaryKeys = knownKey && keys.every(key => {
|
|
189
186
|
if (!meta.primaryKeys.includes(key)) {
|
|
190
187
|
return false;
|
|
191
188
|
}
|
|
192
|
-
if (!
|
|
189
|
+
if (!Utils.isPlainObject(this.payload[key].payload) || ![ReferenceKind.ONE_TO_ONE, ReferenceKind.MANY_TO_ONE].includes(meta.properties[key].kind)) {
|
|
193
190
|
return true;
|
|
194
191
|
}
|
|
195
192
|
return Object.keys(this.payload[key].payload).every(k => meta.properties[key].targetMeta.primaryKeys.includes(k));
|
|
196
193
|
});
|
|
197
194
|
return !primaryKeys && !nestedAlias && !operatorKeys && !embeddable;
|
|
198
195
|
}
|
|
199
|
-
autoJoin(qb, alias) {
|
|
196
|
+
autoJoin(qb, alias, options) {
|
|
200
197
|
const nestedAlias = qb.getNextAlias(this.prop?.pivotTable ?? this.entityName);
|
|
201
|
-
const customExpression =
|
|
202
|
-
const scalar =
|
|
203
|
-
const operator =
|
|
198
|
+
const customExpression = RawQueryFragment.isKnownFragment(this.key);
|
|
199
|
+
const scalar = Utils.isPrimaryKey(this.payload) || this.payload instanceof RegExp || this.payload instanceof Date || customExpression;
|
|
200
|
+
const operator = Utils.isPlainObject(this.payload) && Object.keys(this.payload).every(k => Utils.isOperator(k, false));
|
|
204
201
|
const field = `${alias}.${this.prop.name}`;
|
|
205
|
-
const method = qb.hasFlag(
|
|
206
|
-
|
|
207
|
-
|
|
202
|
+
const method = qb.hasFlag(QueryFlag.INFER_POPULATE) ? 'joinAndSelect' : 'join';
|
|
203
|
+
const path = this.getPath();
|
|
204
|
+
if (this.prop.kind === ReferenceKind.MANY_TO_MANY && (scalar || operator)) {
|
|
205
|
+
qb.join(field, nestedAlias, undefined, JoinType.pivotJoin, path);
|
|
208
206
|
}
|
|
209
207
|
else {
|
|
210
208
|
const prev = qb._fields?.slice();
|
|
211
|
-
qb[method](field, nestedAlias, undefined,
|
|
212
|
-
if (!qb.hasFlag(
|
|
209
|
+
qb[method](field, nestedAlias, undefined, JoinType.leftJoin, path);
|
|
210
|
+
if (!qb.hasFlag(QueryFlag.INFER_POPULATE)) {
|
|
213
211
|
qb._fields = prev;
|
|
214
212
|
}
|
|
215
213
|
}
|
|
214
|
+
if (!options || options.type !== 'orderBy') {
|
|
215
|
+
qb.scheduleFilterCheck(path);
|
|
216
|
+
}
|
|
216
217
|
return nestedAlias;
|
|
217
218
|
}
|
|
218
219
|
isPrefixed(field) {
|
|
219
220
|
return !!field.match(/\w+\./);
|
|
220
221
|
}
|
|
221
222
|
}
|
|
222
|
-
exports.ObjectCriteriaNode = ObjectCriteriaNode;
|
package/query/QueryBuilder.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { inspect } from 'node:util';
|
|
2
|
-
import { type AnyEntity, type ConnectionType, type Dictionary, type EntityData, type EntityKey, type EntityMetadata, type EntityName, type EntityProperty, type ExpandProperty, type FlushMode, type GroupOperator, type Loaded, LockMode, type LoggingOptions, type MetadataStorage, type ObjectQuery, PopulateHint, type PopulateOptions, type QBFilterQuery, type QBQueryOrderMap, QueryFlag, type QueryOrderMap, type QueryResult, RawQueryFragment, type RequiredEntityData, type Transaction } from '@mikro-orm/core';
|
|
3
|
-
import { JoinType, QueryType } from './enums';
|
|
4
|
-
import type { AbstractSqlDriver } from '../AbstractSqlDriver';
|
|
5
|
-
import { type Alias, type OnConflictClause, QueryBuilderHelper } from './QueryBuilderHelper';
|
|
6
|
-
import type { SqlEntityManager } from '../SqlEntityManager';
|
|
7
|
-
import type { Field, ICriteriaNodeProcessOptions, JoinOptions } from '../typings';
|
|
8
|
-
import type { AbstractSqlPlatform } from '../AbstractSqlPlatform';
|
|
9
|
-
import { NativeQueryBuilder } from './NativeQueryBuilder';
|
|
2
|
+
import { type AnyEntity, type ConnectionType, type Dictionary, type EntityData, type EntityKey, type EntityManager, type EntityMetadata, type EntityName, type EntityProperty, type ExpandProperty, type FlushMode, type GroupOperator, type Loaded, LockMode, type LoggingOptions, type MetadataStorage, type ObjectQuery, PopulateHint, type PopulateOptions, type QBFilterQuery, type QBQueryOrderMap, QueryFlag, type QueryOrderMap, type QueryResult, RawQueryFragment, type RequiredEntityData, type Transaction } from '@mikro-orm/core';
|
|
3
|
+
import { JoinType, QueryType } from './enums.js';
|
|
4
|
+
import type { AbstractSqlDriver } from '../AbstractSqlDriver.js';
|
|
5
|
+
import { type Alias, type OnConflictClause, QueryBuilderHelper } from './QueryBuilderHelper.js';
|
|
6
|
+
import type { SqlEntityManager } from '../SqlEntityManager.js';
|
|
7
|
+
import type { Field, ICriteriaNodeProcessOptions, JoinOptions } from '../typings.js';
|
|
8
|
+
import type { AbstractSqlPlatform } from '../AbstractSqlPlatform.js';
|
|
9
|
+
import { NativeQueryBuilder } from './NativeQueryBuilder.js';
|
|
10
10
|
export interface ExecuteOptions {
|
|
11
11
|
mapResults?: boolean;
|
|
12
12
|
mergeResults?: boolean;
|
|
@@ -141,6 +141,15 @@ export declare class QueryBuilder<Entity extends object = AnyEntity, RootAlias e
|
|
|
141
141
|
* Apply filters to the QB where condition.
|
|
142
142
|
*/
|
|
143
143
|
applyFilters(filterOptions?: Dictionary<boolean | Dictionary> | string[] | boolean): Promise<void>;
|
|
144
|
+
private readonly autoJoinedPaths;
|
|
145
|
+
/**
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
scheduleFilterCheck(path: string): void;
|
|
149
|
+
/**
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
applyJoinedFilters(em: EntityManager, filterOptions?: Dictionary<boolean | Dictionary> | string[] | boolean): Promise<void>;
|
|
144
153
|
withSubQuery(subQuery: RawQueryFragment | NativeQueryBuilder, alias: string): this;
|
|
145
154
|
where(cond: QBFilterQuery<Entity>, operator?: keyof typeof GroupOperator): this;
|
|
146
155
|
where(cond: string, params?: any[], operator?: keyof typeof GroupOperator): this;
|
|
@@ -256,10 +265,6 @@ export declare class QueryBuilder<Entity extends object = AnyEntity, RootAlias e
|
|
|
256
265
|
* Executes the query, returning both array of results and total count query (without offset and limit).
|
|
257
266
|
*/
|
|
258
267
|
getResultAndCount(): Promise<[Entity[], number]>;
|
|
259
|
-
/**
|
|
260
|
-
* Provides promise-like interface so we can await the QB instance.
|
|
261
|
-
*/
|
|
262
|
-
then<TResult1 = any, TResult2 = never>(onfulfilled?: ((value: any) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<Loaded<Entity, Hint>[] | number | QueryResult<Entity>>;
|
|
263
268
|
/**
|
|
264
269
|
* Returns native query builder instance with sub-query aliased with given alias.
|
|
265
270
|
* You can provide `EntityName.propName` as alias, then the field name will be used based on the metadata
|
|
@@ -303,14 +308,12 @@ export declare class QueryBuilder<Entity extends object = AnyEntity, RootAlias e
|
|
|
303
308
|
export interface RunQueryBuilder<Entity extends object> extends Omit<QueryBuilder<Entity, any, any>, 'getResult' | 'getSingleResult' | 'getResultList' | 'where'> {
|
|
304
309
|
where(cond: QBFilterQuery<Entity> | string, params?: keyof typeof GroupOperator | any[], operator?: keyof typeof GroupOperator): this;
|
|
305
310
|
execute<Result = QueryResult<Entity>>(method?: 'all' | 'get' | 'run', mapResults?: boolean): Promise<Result>;
|
|
306
|
-
then<TResult1 = QueryResult<Entity>, TResult2 = never>(onfulfilled?: ((value: QueryResult<Entity>) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<QueryResult<Entity>>;
|
|
307
311
|
}
|
|
308
312
|
export interface SelectQueryBuilder<Entity extends object = AnyEntity, RootAlias extends string = never, Hint extends string = never, Context extends object = never> extends QueryBuilder<Entity, RootAlias, Hint, Context> {
|
|
309
313
|
execute<Result = Entity[]>(method?: 'all' | 'get' | 'run', mapResults?: boolean): Promise<Result>;
|
|
310
314
|
execute<Result = Entity[]>(method: 'all', mapResults?: boolean): Promise<Result>;
|
|
311
315
|
execute<Result = Entity>(method: 'get', mapResults?: boolean): Promise<Result>;
|
|
312
316
|
execute<Result = QueryResult<Entity>>(method: 'run', mapResults?: boolean): Promise<Result>;
|
|
313
|
-
then<TResult1 = Entity[], TResult2 = never>(onfulfilled?: ((value: Loaded<Entity, Hint>[]) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<Loaded<Entity, Hint>[]>;
|
|
314
317
|
}
|
|
315
318
|
export interface CountQueryBuilder<Entity extends object> extends QueryBuilder<Entity, any, any> {
|
|
316
319
|
execute<Result = {
|
|
@@ -325,7 +328,6 @@ export interface CountQueryBuilder<Entity extends object> extends QueryBuilder<E
|
|
|
325
328
|
execute<Result = QueryResult<{
|
|
326
329
|
count: number;
|
|
327
330
|
}>>(method: 'run', mapResults?: boolean): Promise<Result>;
|
|
328
|
-
then<TResult1 = number, TResult2 = never>(onfulfilled?: ((value: number) => TResult1 | PromiseLike<TResult1>) | undefined | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | undefined | null): Promise<number>;
|
|
329
331
|
}
|
|
330
332
|
export interface InsertQueryBuilder<T extends object> extends RunQueryBuilder<T> {
|
|
331
333
|
}
|