@easy-cms/drizzle 1.23.1 → 1.24.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.js +7 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1309,7 +1309,13 @@ var DrizzleDatabase = class {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
async count(args) {
|
|
1311
1311
|
const model = this.model(args.collection);
|
|
1312
|
-
const
|
|
1312
|
+
const where = this.where(args.collection, args.where);
|
|
1313
|
+
if (args.max !== void 0) {
|
|
1314
|
+
const matches = this.db.select({ id: model.root.table.id }).from(model.root.table).where(where).limit(args.max + 1).as("matches");
|
|
1315
|
+
const [row2] = await this.db.select({ total: count() }).from(matches);
|
|
1316
|
+
return Number(row2?.total ?? 0);
|
|
1317
|
+
}
|
|
1318
|
+
const [row] = await this.db.select({ total: count() }).from(model.root.table).where(where);
|
|
1313
1319
|
return Number(row?.total ?? 0);
|
|
1314
1320
|
}
|
|
1315
1321
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/drizzle",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Shared Drizzle ORM layer for Easy CMS database adapters",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"drizzle-orm": "0.45.4"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
|
-
"@easy-cms/core": "^1.
|
|
26
|
+
"@easy-cms/core": "^1.24.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@easy-cms/core": "^1.
|
|
29
|
+
"@easy-cms/core": "^1.24.0"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|