@mikro-orm/knex 7.0.0-dev.7 → 7.0.0-dev.71
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 +11 -5
- package/AbstractSqlConnection.js +79 -32
- package/AbstractSqlDriver.d.ts +9 -5
- package/AbstractSqlDriver.js +268 -220
- package/AbstractSqlPlatform.js +3 -3
- package/PivotCollectionPersister.d.ts +3 -2
- package/PivotCollectionPersister.js +12 -21
- 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/postgresql/PostgreSqlTableCompiler.d.ts +1 -0
- package/dialects/postgresql/PostgreSqlTableCompiler.js +1 -0
- package/dialects/sqlite/BaseSqliteConnection.d.ts +4 -2
- package/dialects/sqlite/BaseSqliteConnection.js +8 -5
- package/dialects/sqlite/BaseSqlitePlatform.js +1 -2
- package/dialects/sqlite/SqliteSchemaHelper.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +5 -5
- 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 +12 -7
- package/query/NativeQueryBuilder.js +1 -1
- package/query/ObjectCriteriaNode.d.ts +1 -0
- package/query/ObjectCriteriaNode.js +38 -9
- package/query/QueryBuilder.d.ts +59 -7
- package/query/QueryBuilder.js +171 -47
- package/query/QueryBuilderHelper.d.ts +1 -1
- package/query/QueryBuilderHelper.js +15 -8
- package/query/ScalarCriteriaNode.d.ts +3 -3
- package/query/ScalarCriteriaNode.js +9 -7
- package/query/index.d.ts +1 -0
- package/query/index.js +1 -0
- package/query/raw.d.ts +59 -0
- package/query/raw.js +68 -0
- package/query/rawKnex.d.ts +58 -0
- package/query/rawKnex.js +72 -0
- package/schema/DatabaseSchema.js +25 -4
- package/schema/DatabaseTable.d.ts +5 -4
- package/schema/DatabaseTable.js +67 -33
- package/schema/SchemaComparator.js +2 -2
- package/schema/SchemaHelper.d.ts +2 -0
- package/schema/SchemaHelper.js +8 -4
- package/schema/SqlSchemaGenerator.d.ts +13 -6
- package/schema/SqlSchemaGenerator.js +38 -17
- package/typings.d.ts +85 -3
|
@@ -1,12 +1,14 @@
|
|
|
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
|
|
9
|
-
connect(
|
|
8
|
+
abstract createKyselyDialect(overrides: Dictionary): MaybePromise<Dialect>;
|
|
9
|
+
connect(options?: {
|
|
10
|
+
skipOnConnect?: boolean;
|
|
11
|
+
}): Promise<void>;
|
|
10
12
|
/**
|
|
11
13
|
* @inheritDoc
|
|
12
14
|
*/
|
|
@@ -31,16 +33,20 @@ export declare abstract class AbstractSqlConnection extends Connection {
|
|
|
31
33
|
readOnly?: boolean;
|
|
32
34
|
ctx?: ControlledTransaction<any>;
|
|
33
35
|
eventBroadcaster?: TransactionEventBroadcaster;
|
|
36
|
+
loggerContext?: LogContext;
|
|
34
37
|
}): Promise<T>;
|
|
35
38
|
begin(options?: {
|
|
36
39
|
isolationLevel?: IsolationLevel;
|
|
37
40
|
readOnly?: boolean;
|
|
38
41
|
ctx?: ControlledTransaction<any, any>;
|
|
39
42
|
eventBroadcaster?: TransactionEventBroadcaster;
|
|
43
|
+
loggerContext?: LogContext;
|
|
40
44
|
}): Promise<ControlledTransaction<any, any>>;
|
|
41
|
-
commit(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
42
|
-
rollback(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster): Promise<void>;
|
|
45
|
+
commit(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster, loggerContext?: LogContext): Promise<void>;
|
|
46
|
+
rollback(ctx: ControlledTransaction<any, any>, eventBroadcaster?: TransactionEventBroadcaster, loggerContext?: LogContext): Promise<void>;
|
|
47
|
+
private prepareQuery;
|
|
43
48
|
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>;
|
|
49
|
+
stream<T extends EntityData<AnyEntity>>(query: string | NativeQueryBuilder | RawQueryFragment, params?: readonly unknown[], ctx?: Transaction<Kysely<any>>, loggerContext?: LoggingOptions): AsyncIterableIterator<T>;
|
|
44
50
|
/**
|
|
45
51
|
* Execute raw SQL queries from file
|
|
46
52
|
*/
|
package/AbstractSqlConnection.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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;
|
|
7
|
-
async connect() {
|
|
7
|
+
async connect(options) {
|
|
8
8
|
let driverOptions = this.options.driverOptions ?? this.config.get('driverOptions');
|
|
9
9
|
if (typeof driverOptions === 'function') {
|
|
10
10
|
driverOptions = await driverOptions();
|
|
@@ -19,11 +19,13 @@ 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;
|
|
26
|
+
if (options?.skipOnConnect !== true) {
|
|
27
|
+
await this.onConnect();
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
/**
|
|
29
31
|
* @inheritDoc
|
|
@@ -62,25 +64,28 @@ export class AbstractSqlConnection extends Connection {
|
|
|
62
64
|
const trx = await this.begin(options);
|
|
63
65
|
try {
|
|
64
66
|
const ret = await cb(trx);
|
|
65
|
-
await this.commit(trx, options.eventBroadcaster);
|
|
67
|
+
await this.commit(trx, options.eventBroadcaster, options.loggerContext);
|
|
66
68
|
return ret;
|
|
67
69
|
}
|
|
68
70
|
catch (error) {
|
|
69
|
-
await this.rollback(trx, options.eventBroadcaster);
|
|
71
|
+
await this.rollback(trx, options.eventBroadcaster, options.loggerContext);
|
|
70
72
|
throw error;
|
|
71
73
|
}
|
|
72
74
|
}
|
|
73
75
|
async begin(options = {}) {
|
|
74
76
|
if (options.ctx) {
|
|
75
77
|
const ctx = options.ctx;
|
|
78
|
+
await options.eventBroadcaster?.dispatchEvent(EventType.beforeTransactionStart, ctx);
|
|
76
79
|
ctx.index ??= 0;
|
|
77
80
|
const savepointName = `trx${ctx.index + 1}`;
|
|
78
81
|
const trx = await options.ctx.savepoint(savepointName).execute();
|
|
79
82
|
Reflect.defineProperty(trx, 'index', { value: ctx.index + 1 });
|
|
80
83
|
Reflect.defineProperty(trx, 'savepointName', { value: savepointName });
|
|
81
|
-
this.logQuery(this.platform.getSavepointSQL(savepointName));
|
|
84
|
+
this.logQuery(this.platform.getSavepointSQL(savepointName), options.loggerContext);
|
|
85
|
+
await options.eventBroadcaster?.dispatchEvent(EventType.afterTransactionStart, trx);
|
|
82
86
|
return trx;
|
|
83
87
|
}
|
|
88
|
+
await this.ensureConnection();
|
|
84
89
|
await options.eventBroadcaster?.dispatchEvent(EventType.beforeTransactionStart);
|
|
85
90
|
let trxBuilder = this.client.startTransaction();
|
|
86
91
|
if (options.isolationLevel) {
|
|
@@ -90,39 +95,50 @@ export class AbstractSqlConnection extends Connection {
|
|
|
90
95
|
trxBuilder = trxBuilder.setAccessMode('read only');
|
|
91
96
|
}
|
|
92
97
|
const trx = await trxBuilder.execute();
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
if (options.ctx) {
|
|
99
|
+
const ctx = options.ctx;
|
|
100
|
+
ctx.index ??= 0;
|
|
101
|
+
const savepointName = `trx${ctx.index + 1}`;
|
|
102
|
+
Reflect.defineProperty(trx, 'index', { value: ctx.index + 1 });
|
|
103
|
+
Reflect.defineProperty(trx, 'savepointName', { value: savepointName });
|
|
104
|
+
this.logQuery(this.platform.getSavepointSQL(savepointName), options.loggerContext);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
for (const query of this.platform.getBeginTransactionSQL(options)) {
|
|
108
|
+
this.logQuery(query, options.loggerContext);
|
|
109
|
+
}
|
|
95
110
|
}
|
|
96
111
|
await options.eventBroadcaster?.dispatchEvent(EventType.afterTransactionStart, trx);
|
|
97
112
|
return trx;
|
|
98
113
|
}
|
|
99
|
-
async commit(ctx, eventBroadcaster) {
|
|
114
|
+
async commit(ctx, eventBroadcaster, loggerContext) {
|
|
100
115
|
if (ctx.isRolledBack) {
|
|
101
116
|
return;
|
|
102
117
|
}
|
|
118
|
+
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionCommit, ctx);
|
|
103
119
|
if ('savepointName' in ctx) {
|
|
104
120
|
await ctx.releaseSavepoint(ctx.savepointName).execute();
|
|
105
|
-
this.logQuery(this.platform.getReleaseSavepointSQL(ctx.savepointName));
|
|
106
|
-
|
|
121
|
+
this.logQuery(this.platform.getReleaseSavepointSQL(ctx.savepointName), loggerContext);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
await ctx.commit().execute();
|
|
125
|
+
this.logQuery(this.platform.getCommitTransactionSQL(), loggerContext);
|
|
107
126
|
}
|
|
108
|
-
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionCommit, ctx);
|
|
109
|
-
await ctx.commit().execute();
|
|
110
|
-
this.logQuery(this.platform.getCommitTransactionSQL());
|
|
111
127
|
await eventBroadcaster?.dispatchEvent(EventType.afterTransactionCommit, ctx);
|
|
112
128
|
}
|
|
113
|
-
async rollback(ctx, eventBroadcaster) {
|
|
129
|
+
async rollback(ctx, eventBroadcaster, loggerContext) {
|
|
130
|
+
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionRollback, ctx);
|
|
114
131
|
if ('savepointName' in ctx) {
|
|
115
132
|
await ctx.rollbackToSavepoint(ctx.savepointName).execute();
|
|
116
|
-
this.logQuery(this.platform.getRollbackToSavepointSQL(ctx.savepointName));
|
|
117
|
-
|
|
133
|
+
this.logQuery(this.platform.getRollbackToSavepointSQL(ctx.savepointName), loggerContext);
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
await ctx.rollback().execute();
|
|
137
|
+
this.logQuery(this.platform.getRollbackTransactionSQL(), loggerContext);
|
|
118
138
|
}
|
|
119
|
-
await eventBroadcaster?.dispatchEvent(EventType.beforeTransactionRollback, ctx);
|
|
120
|
-
await ctx.rollback().execute();
|
|
121
|
-
this.logQuery(this.platform.getRollbackTransactionSQL());
|
|
122
139
|
await eventBroadcaster?.dispatchEvent(EventType.afterTransactionRollback, ctx);
|
|
123
140
|
}
|
|
124
|
-
|
|
125
|
-
await this.ensureConnection();
|
|
141
|
+
prepareQuery(query, params = []) {
|
|
126
142
|
if (query instanceof NativeQueryBuilder) {
|
|
127
143
|
query = query.toRaw();
|
|
128
144
|
}
|
|
@@ -132,16 +148,47 @@ export class AbstractSqlConnection extends Connection {
|
|
|
132
148
|
}
|
|
133
149
|
query = this.config.get('onQuery')(query, params);
|
|
134
150
|
const formatted = this.platform.formatQuery(query, params);
|
|
135
|
-
|
|
151
|
+
return { query, params, formatted };
|
|
152
|
+
}
|
|
153
|
+
async execute(query, params = [], method = 'all', ctx, loggerContext) {
|
|
154
|
+
await this.ensureConnection();
|
|
155
|
+
const q = this.prepareQuery(query, params);
|
|
156
|
+
const sql = this.getSql(q.query, q.formatted, loggerContext);
|
|
136
157
|
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);
|
|
158
|
+
const compiled = CompiledQuery.raw(q.formatted);
|
|
159
|
+
const res = await (ctx ?? this.client).executeQuery(compiled);
|
|
143
160
|
return this.transformRawResult(res, method);
|
|
144
|
-
}, {
|
|
161
|
+
}, { ...q, ...loggerContext });
|
|
162
|
+
}
|
|
163
|
+
async *stream(query, params = [], ctx, loggerContext) {
|
|
164
|
+
await this.ensureConnection();
|
|
165
|
+
const q = this.prepareQuery(query, params);
|
|
166
|
+
const sql = this.getSql(q.query, q.formatted, loggerContext);
|
|
167
|
+
// construct the compiled query manually with `kind: 'SelectQueryNode'` to avoid sqlite validation for select queries when streaming
|
|
168
|
+
const compiled = {
|
|
169
|
+
query: {
|
|
170
|
+
kind: 'SelectQueryNode',
|
|
171
|
+
},
|
|
172
|
+
sql: q.formatted,
|
|
173
|
+
parameters: [],
|
|
174
|
+
};
|
|
175
|
+
try {
|
|
176
|
+
const res = (ctx ?? this.client).getExecutor().stream(compiled, 1);
|
|
177
|
+
this.logQuery(sql, {
|
|
178
|
+
sql, params,
|
|
179
|
+
...loggerContext,
|
|
180
|
+
affected: Utils.isPlainObject(res) ? res.affectedRows : undefined,
|
|
181
|
+
});
|
|
182
|
+
for await (const items of res) {
|
|
183
|
+
for (const row of this.transformRawResult(items, 'all')) {
|
|
184
|
+
yield row;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (e) {
|
|
189
|
+
this.logQuery(sql, { sql, params, ...loggerContext, level: 'error' });
|
|
190
|
+
throw e;
|
|
191
|
+
}
|
|
145
192
|
}
|
|
146
193
|
/**
|
|
147
194
|
* 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
|
+
private createQueryBuilderFromOptions;
|
|
17
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>[]>;
|
|
18
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
21
|
findVirtual<T extends object>(entityName: string, where: ObjectQuery<T>, options: FindOptions<T, any, any, any>): Promise<EntityData<T>[]>;
|
|
21
22
|
countVirtual<T extends object>(entityName: string, where: ObjectQuery<T>, options: CountOptions<T, any>): Promise<number>;
|
|
22
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,8 @@ 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>[]
|
|
76
|
-
protected
|
|
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'>, count?: boolean): Field<T>[];
|
|
80
|
+
protected processField<T extends object>(meta: EntityMetadata<T>, prop: EntityProperty<T> | undefined, field: string, ret: Field<T>[]): void;
|
|
81
|
+
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
82
|
}
|
|
79
83
|
interface FieldsForJoinedLoadOptions<T extends object> {
|
|
80
84
|
explicitFields?: readonly Field<T>[];
|