@mikro-orm/knex 6.3.14-dev.41 → 6.3.14-dev.43
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/package.json +2 -2
- package/query/QueryBuilder.d.ts +3 -1
- package/query/QueryBuilder.js +15 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mikro-orm/knex",
|
|
3
|
-
"version": "6.3.14-dev.
|
|
3
|
+
"version": "6.3.14-dev.43",
|
|
4
4
|
"description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.mjs",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"@mikro-orm/core": "^6.3.13"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@mikro-orm/core": "6.3.14-dev.
|
|
69
|
+
"@mikro-orm/core": "6.3.14-dev.43",
|
|
70
70
|
"better-sqlite3": "*",
|
|
71
71
|
"libsql": "*",
|
|
72
72
|
"mariadb": "*"
|
package/query/QueryBuilder.d.ts
CHANGED
|
@@ -156,7 +156,9 @@ export declare class QueryBuilder<Entity extends object = AnyEntity, RootAlias e
|
|
|
156
156
|
orWhere(cond: string, params?: any[]): this;
|
|
157
157
|
orderBy(orderBy: QBQueryOrderMap<Entity> | QBQueryOrderMap<Entity>[]): SelectQueryBuilder<Entity, RootAlias, Hint, Context>;
|
|
158
158
|
groupBy(fields: EntityKeyOrString<Entity> | readonly EntityKeyOrString<Entity>[]): SelectQueryBuilder<Entity, RootAlias, Hint, Context>;
|
|
159
|
-
having(cond?: QBFilterQuery | string, params?: any[]): SelectQueryBuilder<Entity, RootAlias, Hint, Context>;
|
|
159
|
+
having(cond?: QBFilterQuery | string, params?: any[], operator?: keyof typeof GroupOperator): SelectQueryBuilder<Entity, RootAlias, Hint, Context>;
|
|
160
|
+
andHaving(cond?: QBFilterQuery | string, params?: any[]): SelectQueryBuilder<Entity, RootAlias, Hint, Context>;
|
|
161
|
+
orHaving(cond?: QBFilterQuery | string, params?: any[]): SelectQueryBuilder<Entity, RootAlias, Hint, Context>;
|
|
160
162
|
onConflict(fields?: Field<Entity> | Field<Entity>[]): InsertQueryBuilder<Entity>;
|
|
161
163
|
ignore(): this;
|
|
162
164
|
merge(data?: EntityData<Entity> | Field<Entity>[]): this;
|
package/query/QueryBuilder.js
CHANGED
|
@@ -348,14 +348,27 @@ class QueryBuilder {
|
|
|
348
348
|
this._groupBy = core_1.Utils.asArray(fields);
|
|
349
349
|
return this;
|
|
350
350
|
}
|
|
351
|
-
having(cond = {}, params) {
|
|
351
|
+
having(cond = {}, params, operator) {
|
|
352
352
|
this.ensureNotFinalized();
|
|
353
353
|
if (core_1.Utils.isString(cond)) {
|
|
354
354
|
cond = { [(0, core_1.raw)(`(${cond})`, params)]: [] };
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
cond = CriteriaNodeFactory_1.CriteriaNodeFactory.createNode(this.metadata, this.mainAlias.entityName, cond).process(this);
|
|
357
|
+
if (!this._having || !operator) {
|
|
358
|
+
this._having = cond;
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
const cond1 = [this._having, cond];
|
|
362
|
+
this._having = { [operator]: cond1 };
|
|
363
|
+
}
|
|
357
364
|
return this;
|
|
358
365
|
}
|
|
366
|
+
andHaving(cond, params) {
|
|
367
|
+
return this.having(cond, params, '$and');
|
|
368
|
+
}
|
|
369
|
+
orHaving(cond, params) {
|
|
370
|
+
return this.having(cond, params, '$or');
|
|
371
|
+
}
|
|
359
372
|
onConflict(fields = []) {
|
|
360
373
|
const meta = this.mainAlias.metadata;
|
|
361
374
|
this.ensureNotFinalized();
|