@mikro-orm/knex 7.0.0-dev.4 → 7.0.0-dev.41
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 +8 -4
- package/AbstractSqlConnection.js +75 -31
- package/AbstractSqlDriver.d.ts +14 -9
- package/AbstractSqlDriver.js +273 -213
- package/AbstractSqlPlatform.js +3 -3
- package/PivotCollectionPersister.d.ts +3 -2
- package/PivotCollectionPersister.js +6 -2
- package/README.md +3 -2
- package/SqlEntityManager.d.ts +9 -2
- package/SqlEntityManager.js +2 -2
- package/dialects/mssql/MsSqlNativeQueryBuilder.d.ts +2 -0
- package/dialects/mssql/MsSqlNativeQueryBuilder.js +43 -2
- package/dialects/mysql/MySqlPlatform.js +2 -1
- package/dialects/postgresql/PostgreSqlTableCompiler.d.ts +1 -0
- package/dialects/postgresql/PostgreSqlTableCompiler.js +1 -0
- package/dialects/sqlite/BaseSqliteConnection.d.ts +1 -1
- package/dialects/sqlite/BaseSqliteConnection.js +8 -2
- package/dialects/sqlite/BaseSqlitePlatform.d.ts +0 -1
- package/dialects/sqlite/BaseSqlitePlatform.js +0 -4
- package/dialects/sqlite/SqliteSchemaHelper.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +4 -4
- package/query/ArrayCriteriaNode.d.ts +1 -0
- package/query/ArrayCriteriaNode.js +3 -0
- package/query/CriteriaNode.d.ts +4 -2
- package/query/CriteriaNode.js +11 -6
- package/query/CriteriaNodeFactory.js +11 -6
- package/query/NativeQueryBuilder.js +1 -1
- package/query/ObjectCriteriaNode.d.ts +1 -0
- package/query/ObjectCriteriaNode.js +38 -7
- package/query/QueryBuilder.d.ts +67 -6
- package/query/QueryBuilder.js +195 -43
- package/query/QueryBuilderHelper.d.ts +1 -1
- package/query/QueryBuilderHelper.js +13 -6
- package/query/ScalarCriteriaNode.d.ts +3 -3
- package/query/ScalarCriteriaNode.js +7 -5
- package/query/index.d.ts +1 -0
- package/query/index.js +1 -0
- package/query/raw.d.ts +58 -0
- package/query/raw.js +72 -0
- package/schema/DatabaseSchema.js +25 -4
- package/schema/DatabaseTable.d.ts +5 -4
- package/schema/DatabaseTable.js +80 -34
- package/schema/SchemaComparator.js +2 -2
- package/schema/SchemaHelper.d.ts +2 -0
- package/schema/SchemaHelper.js +8 -4
- package/schema/SqlSchemaGenerator.d.ts +6 -1
- package/schema/SqlSchemaGenerator.js +22 -3
- package/typings.d.ts +86 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type ControlledTransaction, type Dialect, Kysely } from 'kysely';
|
|
2
|
-
import { type AnyEntity, Connection, type Dictionary, type EntityData, type IsolationLevel, type LoggingOptions, type QueryResult, RawQueryFragment, type Transaction, type TransactionEventBroadcaster } from '@mikro-orm/core';
|
|
2
|
+
import { type AnyEntity, Connection, type Dictionary, type EntityData, type IsolationLevel, type LogContext, type LoggingOptions, type MaybePromise, type QueryResult, RawQueryFragment, type Transaction, type TransactionEventBroadcaster } from '@mikro-orm/core';
|
|
3
3
|
import type { AbstractSqlPlatform } from './AbstractSqlPlatform.js';
|
|
4
4
|
import { NativeQueryBuilder } from './query/NativeQueryBuilder.js';
|
|
5
5
|
export declare abstract class AbstractSqlConnection extends Connection {
|
|
6
6
|
protected platform: AbstractSqlPlatform;
|
|
7
7
|
protected client: Kysely<any>;
|
|
8
|
-
abstract createKyselyDialect(overrides: Dictionary): Dialect
|
|
8
|
+
abstract createKyselyDialect(overrides: Dictionary): MaybePromise<Dialect>;
|
|
9
9
|
connect(): Promise<void>;
|
|
10
10
|
/**
|
|
11
11
|
* @inheritDoc
|
|
@@ -31,16 +31,20 @@ export declare abstract class AbstractSqlConnection extends Connection {
|
|
|
31
31
|
readOnly?: boolean;
|
|
32
32
|
ctx?: ControlledTransaction<any>;
|
|
33
33
|
eventBroadcaster?: TransactionEventBroadcaster;
|
|
34
|
+
loggerContext?: LogContext;
|
|
34
35
|
}): Promise<T>;
|
|
35
36
|
begin(options?: {
|
|
36
37
|
isolationLevel?: IsolationLevel;
|
|
37
38
|
readOnly?: boolean;
|
|
38
39
|
ctx?: ControlledTransaction<any, any>;
|
|
39
40
|
eventBroadcaster?: TransactionEventBroadcaster;
|
|
41
|
+
loggerContext?: LogContext;
|
|
40
42
|
}): Promise<ControlledTransaction<any, any>>;
|
|
41
|
-
commit(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
42
|
-
rollback(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
43
|
+
commit(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster, loggerContext?: LogContext): Promise<void>;
|
|
44
|
+
rollback(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster, loggerContext?: LogContext): Promise<void>;
|
|
45
|
+
private prepareQuery;
|
|
43
46
|
execute<T extends QueryResult | EntityData<AnyEntity> | EntityData<AnyEntity>[] = EntityData<AnyEntity>[]>(query: string | NativeQueryBuilder | RawQueryFragment, params?: readonly unknown[], method?: 'all' | 'get' | 'run', ctx?: Transaction, loggerContext?: LoggingOptions): Promise<T>;
|
|
47
|
+
stream<T extends EntityData<AnyEntity>>(query: string | NativeQueryBuilder | RawQueryFragment, params?: readonly unknown[], ctx?: Transaction<Kysely<any>>, loggerContext?: LoggingOptions): AsyncIterableIterator<T>;
|
|
44
48
|
/**
|
|
45
49
|
* Execute raw SQL queries from file
|
|
46
50
|
*/
|
package/AbstractSqlConnection.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CompiledQuery, Kysely
|
|
1
|
+
import { CompiledQuery, Kysely } from 'kysely';
|
|
2
2
|
import { readFile } from 'node:fs/promises';
|
|
3
|
-
import { Connection, EventType, RawQueryFragment, } from '@mikro-orm/core';
|
|
3
|
+
import { Connection, EventType, RawQueryFragment, Utils, } from '@mikro-orm/core';
|
|
4
4
|
import { NativeQueryBuilder } from './query/NativeQueryBuilder.js';
|
|
5
5
|
export class AbstractSqlConnection extends Connection {
|
|
6
6
|
client;
|
|
@@ -19,8 +19,7 @@ export class AbstractSqlConnection extends Connection {
|
|
|
19
19
|
}
|
|
20
20
|
else {
|
|
21
21
|
this.client = new Kysely({
|
|
22
|
-
dialect: this.createKyselyDialect(driverOptions),
|
|
23
|
-
// log: m => console.log(m),
|
|
22
|
+
dialect: await this.createKyselyDialect(driverOptions),
|
|
24
23
|
});
|
|
25
24
|
}
|
|
26
25
|
this.connected = true;
|
|
@@ -62,25 +61,28 @@ export class AbstractSqlConnection extends Connection {
|
|
|
62
61
|
const trx = await this.begin(options);
|
|
63
62
|
try {
|
|
64
63
|
const ret = await cb(trx);
|
|
65
|
-
await this.commit(trx, options.eventBroadcaster);
|
|
64
|
+
await this.commit(trx, options.eventBroadcaster, options.loggerContext);
|
|
66
65
|
return ret;
|
|
67
66
|
}
|
|
68
67
|
catch (error) {
|
|
69
|
-
await this.rollback(trx, options.eventBroadcaster);
|
|
68
|
+
await this.rollback(trx, options.eventBroadcaster, options.loggerContext);
|
|
70
69
|
throw error;
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
async begin(options = {}) {
|
|
74
73
|
if (options.ctx) {
|
|
75
74
|
const ctx = options.ctx;
|
|
75
|
+
await options.eventBroadcaster?.dispatchEvent(EventType.beforeTransactionStart, ctx);
|
|
76
76
|
ctx.index ??= 0;
|
|
77
77
|
const savepointName = `trx${ctx.index + 1}`;
|
|
78
78
|
const trx = await options.ctx.savepoint(savepointName).execute();
|
|
79
79
|
Reflect.defineProperty(trx, 'index', { value: ctx.index + 1 });
|
|
80
80
|
Reflect.defineProperty(trx, 'savepointName', { value: savepointName });
|
|
81
|
-
this.logQuery(this.platform.getSavepointSQL(savepointName));
|
|
81
|
+
this.logQuery(this.platform.getSavepointSQL(savepointName), options.loggerContext);
|
|
82
|
+
await options.eventBroadcaster?.dispatchEvent(EventType.afterTransactionStart, trx);
|
|
82
83
|
return trx;
|
|
83
84
|
}
|
|
85
|
+
await this.ensureConnection();
|
|
84
86
|
await options.eventBroadcaster?.dispatchEvent(EventType.beforeTransactionStart);
|
|
85
87
|
let trxBuilder = this.client.startTransaction();
|
|
86
88
|
if (options.isolationLevel) {
|
|
@@ -90,39 +92,50 @@ export class AbstractSqlConnection extends Connection {
|
|
|
90
92
|
trxBuilder = trxBuilder.setAccessMode('read only');
|
|
91
93
|
}
|
|
92
94
|
const trx = await trxBuilder.execute();
|
|
93
|
-
|
|
94
|
-
|
|
95
|
+
if (options.ctx) {
|
|
96
|
+
const ctx = options.ctx;
|
|
97
|
+
ctx.index ??= 0;
|
|
98
|
+
const savepointName = `trx${ctx.index + 1}`;
|
|
99
|
+
Reflect.defineProperty(trx, 'index', { value: ctx.index + 1 });
|
|
100
|
+
Reflect.defineProperty(trx, 'savepointName', { value: savepointName });
|
|
101
|
+
this.logQuery(this.platform.getSavepointSQL(savepointName), options.loggerContext);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
for (const query of this.platform.getBeginTransactionSQL(options)) {
|
|
105
|
+
this.logQuery(query, options.loggerContext);
|
|
106
|
+
}
|
|
95
107
|
}
|
|
96
108
|
await options.eventBroadcaster?.dispatchEvent(EventType.afterTransactionStart, trx);
|
|
97
109
|
return trx;
|
|
98
110
|
}
|
|
99
|
-
async commit(ctx, eventBroadcaster) {
|
|
111
|
+
async commit(ctx, eventBroadcaster, loggerContext) {
|
|
100
112
|
if (ctx.isRolledBack) {
|
|
101
113
|
return;
|
|
102
114
|
}
|
|
115
|
+
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionCommit, ctx);
|
|
103
116
|
if ('savepointName' in ctx) {
|
|
104
117
|
await ctx.releaseSavepoint(ctx.savepointName).execute();
|
|
105
|
-
this.logQuery(this.platform.getReleaseSavepointSQL(ctx.savepointName));
|
|
106
|
-
|
|
118
|
+
this.logQuery(this.platform.getReleaseSavepointSQL(ctx.savepointName), loggerContext);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
await ctx.commit().execute();
|
|
122
|
+
this.logQuery(this.platform.getCommitTransactionSQL(), loggerContext);
|
|
107
123
|
}
|
|
108
|
-
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionCommit, ctx);
|
|
109
|
-
await ctx.commit().execute();
|
|
110
|
-
this.logQuery(this.platform.getCommitTransactionSQL());
|
|
111
124
|
await eventBroadcaster?.dispatchEvent(EventType.afterTransactionCommit, ctx);
|
|
112
125
|
}
|
|
113
|
-
async rollback(ctx, eventBroadcaster) {
|
|
126
|
+
async rollback(ctx, eventBroadcaster, loggerContext) {
|
|
127
|
+
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionRollback, ctx);
|
|
114
128
|
if ('savepointName' in ctx) {
|
|
115
129
|
await ctx.rollbackToSavepoint(ctx.savepointName).execute();
|
|
116
|
-
this.logQuery(this.platform.getRollbackToSavepointSQL(ctx.savepointName));
|
|
117
|
-
|
|
130
|
+
this.logQuery(this.platform.getRollbackToSavepointSQL(ctx.savepointName), loggerContext);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
await ctx.rollback().execute();
|
|
134
|
+
this.logQuery(this.platform.getRollbackTransactionSQL(), loggerContext);
|
|
118
135
|
}
|
|
119
|
-
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionRollback, ctx);
|
|
120
|
-
await ctx.rollback().execute();
|
|
121
|
-
this.logQuery(this.platform.getRollbackTransactionSQL());
|
|
122
136
|
await eventBroadcaster?.dispatchEvent(EventType.afterTransactionRollback, ctx);
|
|
123
137
|
}
|
|
124
|
-
|
|
125
|
-
await this.ensureConnection();
|
|
138
|
+
prepareQuery(query, params = []) {
|
|
126
139
|
if (query instanceof NativeQueryBuilder) {
|
|
127
140
|
query = query.toRaw();
|
|
128
141
|
}
|
|
@@ -132,16 +145,47 @@ export class AbstractSqlConnection extends Connection {
|
|
|
132
145
|
}
|
|
133
146
|
query = this.config.get('onQuery')(query, params);
|
|
134
147
|
const formatted = this.platform.formatQuery(query, params);
|
|
135
|
-
|
|
148
|
+
return { query, params, formatted };
|
|
149
|
+
}
|
|
150
|
+
async execute(query, params = [], method = 'all', ctx, loggerContext) {
|
|
151
|
+
await this.ensureConnection();
|
|
152
|
+
const q = this.prepareQuery(query, params);
|
|
153
|
+
const sql = this.getSql(q.query, q.formatted, loggerContext);
|
|
136
154
|
return this.executeQuery(sql, async () => {
|
|
137
|
-
const compiled = CompiledQuery.raw(formatted);
|
|
138
|
-
|
|
139
|
-
const res = await ctx.executeQuery(compiled);
|
|
140
|
-
return this.transformRawResult(res, method);
|
|
141
|
-
}
|
|
142
|
-
const res = await this.client.executeQuery(compiled);
|
|
155
|
+
const compiled = CompiledQuery.raw(q.formatted);
|
|
156
|
+
const res = await (ctx ?? this.client).executeQuery(compiled);
|
|
143
157
|
return this.transformRawResult(res, method);
|
|
144
|
-
}, {
|
|
158
|
+
}, { ...q, ...loggerContext });
|
|
159
|
+
}
|
|
160
|
+
async *stream(query, params = [], ctx, loggerContext) {
|
|
161
|
+
await this.ensureConnection();
|
|
162
|
+
const q = this.prepareQuery(query, params);
|
|
163
|
+
const sql = this.getSql(q.query, q.formatted, loggerContext);
|
|
164
|
+
// construct the compiled query manually with `kind: 'SelectQueryNode'` to avoid sqlite validation for select queries when streaming
|
|
165
|
+
const compiled = {
|
|
166
|
+
query: {
|
|
167
|
+
kind: 'SelectQueryNode',
|
|
168
|
+
},
|
|
169
|
+
sql: q.formatted,
|
|
170
|
+
parameters: [],
|
|
171
|
+
};
|
|
172
|
+
try {
|
|
173
|
+
const res = (ctx ?? this.client).getExecutor().stream(compiled, 1);
|
|
174
|
+
this.logQuery(sql, {
|
|
175
|
+
sql, params,
|
|
176
|
+
...loggerContext,
|
|
177
|
+
affected: Utils.isPlainObject(res) ? res.affectedRows : undefined,
|
|
178
|
+
});
|
|
179
|
+
for await (const items of res) {
|
|
180
|
+
for (const row of this.transformRawResult(items, 'all')) {
|
|
181
|
+
yield row;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
this.logQuery(sql, { sql, params, ...loggerContext, level: 'error' });
|
|
187
|
+
throw e;
|
|
188
|
+
}
|
|
145
189
|
}
|
|
146
190
|
/**
|
|
147
191
|
* Execute raw SQL queries from file
|
package/AbstractSqlDriver.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnyEntity, type Collection, type Configuration, type ConnectionType, type Constructor, type CountOptions, DatabaseDriver, type DeleteOptions, type Dictionary, type DriverMethodOptions, type EntityData, type EntityDictionary, type EntityField, EntityManagerType, type EntityMetadata, type EntityName, type EntityProperty, type FilterQuery, type FindOneOptions, type FindOptions, type LockOptions, type LoggingOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type ObjectQuery, type Options, type OrderDefinition, type PopulateOptions, type PopulatePath, type Primary, type QueryOrderMap, type QueryResult, RawQueryFragment, type Transaction, type UpsertManyOptions, type UpsertOptions } from '@mikro-orm/core';
|
|
1
|
+
import { type AnyEntity, type Collection, type Configuration, type ConnectionType, type Constructor, type CountOptions, DatabaseDriver, type DeleteOptions, type Dictionary, type DriverMethodOptions, type EntityData, type EntityDictionary, type EntityField, EntityManagerType, type EntityMetadata, type EntityName, type EntityProperty, type FilterQuery, type FindOneOptions, type FindOptions, type LockOptions, type LoggingOptions, type NativeInsertUpdateManyOptions, type NativeInsertUpdateOptions, type ObjectQuery, type Options, type OrderDefinition, type PopulateOptions, type PopulatePath, type Primary, type QueryOrderMap, type QueryResult, RawQueryFragment, type StreamOptions, type Transaction, type UpsertManyOptions, type UpsertOptions } from '@mikro-orm/core';
|
|
2
2
|
import type { AbstractSqlConnection } from './AbstractSqlConnection.js';
|
|
3
3
|
import type { AbstractSqlPlatform } from './AbstractSqlPlatform.js';
|
|
4
4
|
import { QueryBuilder } from './query/QueryBuilder.js';
|
|
@@ -14,13 +14,16 @@ export declare abstract class AbstractSqlDriver<Connection extends AbstractSqlCo
|
|
|
14
14
|
protected constructor(config: Configuration, platform: Platform, connection: Constructor<Connection>, connector: string[]);
|
|
15
15
|
getPlatform(): Platform;
|
|
16
16
|
createEntityManager(useContext?: boolean): this[typeof EntityManagerType];
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
private createQueryBuilderFromOptions;
|
|
18
|
+
find<T extends object, P extends string = never, F extends string = PopulatePath.ALL, E extends string = never>(entityName: string, where: ObjectQuery<T>, options?: FindOptions<T, P, F, E>): Promise<EntityData<T>[]>;
|
|
19
|
+
findOne<T extends object, P extends string = never, F extends string = PopulatePath.ALL, E extends string = never>(entityName: string, where: ObjectQuery<T>, options?: FindOneOptions<T, P, F, E>): Promise<EntityData<T> | null>;
|
|
19
20
|
protected hasToManyJoins<T extends object>(hint: PopulateOptions<T>, meta: EntityMetadata<T>): boolean;
|
|
20
|
-
findVirtual<T extends object>(entityName: string, where:
|
|
21
|
-
countVirtual<T extends object>(entityName: string, where:
|
|
22
|
-
protected findFromVirtual<T extends object>(entityName: string, where:
|
|
21
|
+
findVirtual<T extends object>(entityName: string, where: ObjectQuery<T>, options: FindOptions<T, any, any, any>): Promise<EntityData<T>[]>;
|
|
22
|
+
countVirtual<T extends object>(entityName: string, where: ObjectQuery<T>, options: CountOptions<T, any>): Promise<number>;
|
|
23
|
+
protected findFromVirtual<T extends object>(entityName: string, where: ObjectQuery<T>, options: FindOptions<T, any> | CountOptions<T, any>, type: QueryType): Promise<EntityData<T>[] | number>;
|
|
24
|
+
protected streamFromVirtual<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, options: StreamOptions<T, any>): AsyncIterableIterator<EntityData<T>>;
|
|
23
25
|
protected wrapVirtualExpressionInSubquery<T extends object>(meta: EntityMetadata<T>, expression: string, where: FilterQuery<T>, options: FindOptions<T, any>, type: QueryType): Promise<T[] | number>;
|
|
26
|
+
protected wrapVirtualExpressionInSubqueryStream<T extends object>(meta: EntityMetadata<T>, expression: string, where: FilterQuery<T>, options: FindOptions<T, any, any, any>, type: QueryType.SELECT): AsyncIterableIterator<T>;
|
|
24
27
|
mapResult<T extends object>(result: EntityData<T>, meta: EntityMetadata<T>, populate?: PopulateOptions<T>[], qb?: QueryBuilder<T, any, any, any>, map?: Dictionary): EntityData<T> | null;
|
|
25
28
|
private mapJoinedProps;
|
|
26
29
|
count<T extends object>(entityName: string, where: any, options?: CountOptions<T>): Promise<number>;
|
|
@@ -39,6 +42,7 @@ export declare abstract class AbstractSqlDriver<Connection extends AbstractSqlCo
|
|
|
39
42
|
loadFromPivotTable<T extends object, O extends object>(prop: EntityProperty, owners: Primary<O>[][], where?: FilterQuery<any>, orderBy?: OrderDefinition<T>, ctx?: Transaction, options?: FindOptions<T, any, any, any>, pivotJoin?: boolean): Promise<Dictionary<T[]>>;
|
|
40
43
|
private getPivotOrderBy;
|
|
41
44
|
execute<T extends QueryResult | EntityData<AnyEntity> | EntityData<AnyEntity>[] = EntityData<AnyEntity>[]>(query: string | NativeQueryBuilder | RawQueryFragment, params?: any[], method?: 'all' | 'get' | 'run', ctx?: Transaction, loggerContext?: LoggingOptions): Promise<T>;
|
|
45
|
+
stream<T extends object>(entityName: EntityName<T>, where: FilterQuery<T>, options: StreamOptions<T, any, any, any>): AsyncIterableIterator<T>;
|
|
42
46
|
/**
|
|
43
47
|
* 1:1 owner side needs to be marked for population so QB auto-joins the owner id
|
|
44
48
|
*/
|
|
@@ -53,11 +57,12 @@ export declare abstract class AbstractSqlDriver<Connection extends AbstractSqlCo
|
|
|
53
57
|
* @internal
|
|
54
58
|
*/
|
|
55
59
|
mergeJoinedResult<T extends object>(rawResults: EntityData<T>[], meta: EntityMetadata<T>, joinedProps: PopulateOptions<T>[]): EntityData<T>[];
|
|
60
|
+
protected shouldHaveColumn<T, U>(meta: EntityMetadata<T>, prop: EntityProperty<U>, populate: readonly PopulateOptions<U>[], fields?: readonly Field<U>[], exclude?: readonly Field<U>[]): boolean;
|
|
56
61
|
protected getFieldsForJoinedLoad<T extends object>(qb: QueryBuilder<T, any, any, any>, meta: EntityMetadata<T>, options: FieldsForJoinedLoadOptions<T>): Field<T>[];
|
|
57
62
|
/**
|
|
58
63
|
* @internal
|
|
59
64
|
*/
|
|
60
|
-
mapPropToFieldNames<T extends object>(qb: QueryBuilder<T, any, any, any>, prop: EntityProperty<T>, tableAlias: string): Field<T>[];
|
|
65
|
+
mapPropToFieldNames<T extends object>(qb: QueryBuilder<T, any, any, any>, prop: EntityProperty<T>, tableAlias: string, explicitFields?: readonly Field<T>[]): Field<T>[];
|
|
61
66
|
/** @internal */
|
|
62
67
|
createQueryBuilder<T extends object>(entityName: EntityName<T> | QueryBuilder<T, any, any, any>, ctx?: Transaction, preferredConnectionType?: ConnectionType, convertCustomTypes?: boolean, loggerContext?: LoggingOptions, alias?: string, em?: SqlEntityManager): QueryBuilder<T, any, any, any>;
|
|
63
68
|
protected resolveConnectionType(args: {
|
|
@@ -72,9 +77,9 @@ export declare abstract class AbstractSqlDriver<Connection extends AbstractSqlCo
|
|
|
72
77
|
protected buildPopulateOrderBy<T extends object>(qb: QueryBuilder<T, any, any, any>, meta: EntityMetadata<T>, populateOrderBy: QueryOrderMap<T>[], parentPath: string, explicit: boolean, parentAlias?: string): QueryOrderMap<T>[];
|
|
73
78
|
protected buildJoinedPropsOrderBy<T extends object>(qb: QueryBuilder<T, any, any, any>, meta: EntityMetadata<T>, populate: PopulateOptions<T>[], options?: Pick<FindOptions<any>, 'strategy' | 'orderBy' | 'populateOrderBy'>, parentPath?: string): QueryOrderMap<T>[];
|
|
74
79
|
protected normalizeFields<T extends object>(fields: Field<T>[], prefix?: string): string[];
|
|
75
|
-
protected processField<T extends object>(meta: EntityMetadata<T>, prop: EntityProperty<T> | undefined, field: string, ret: Field<T>[]
|
|
80
|
+
protected processField<T extends object>(meta: EntityMetadata<T>, prop: EntityProperty<T> | undefined, field: string, ret: Field<T>[]): void;
|
|
76
81
|
protected isPopulated<T extends object>(meta: EntityMetadata<T>, prop: EntityProperty<T>, hint: PopulateOptions<T>, name?: string): boolean;
|
|
77
|
-
protected buildFields<T extends object>(meta: EntityMetadata<T>, populate: PopulateOptions<T>[], joinedProps: PopulateOptions<T>[], qb: QueryBuilder<T, any, any, any>, alias: string, options: Pick<FindOptions<T, any, any, any>, 'strategy' | 'fields' | 'exclude'
|
|
82
|
+
protected buildFields<T extends object>(meta: EntityMetadata<T>, populate: PopulateOptions<T>[], joinedProps: PopulateOptions<T>[], qb: QueryBuilder<T, any, any, any>, alias: string, options: Pick<FindOptions<T, any, any, any>, 'strategy' | 'fields' | 'exclude'>): Field<T>[];
|
|
78
83
|
}
|
|
79
84
|
interface FieldsForJoinedLoadOptions<T extends object> {
|
|
80
85
|
explicitFields?: readonly Field<T>[];
|