@itrocks/mysql 0.1.4 → 0.1.5
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/cjs/mysql.js +8 -6
- package/esm/mysql.js +8 -6
- package/package.json +1 -1
package/cjs/mysql.js
CHANGED
|
@@ -56,9 +56,10 @@ class Mysql extends storage_1.DataSource {
|
|
|
56
56
|
}
|
|
57
57
|
async count(type, search = {}) {
|
|
58
58
|
const connection = this.connection ?? await this.connect();
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
59
|
+
const localSearch = { ...search };
|
|
60
|
+
Object.setPrototypeOf(localSearch, type.prototype);
|
|
61
|
+
const sql = this.propertiesToSearchSql(localSearch);
|
|
62
|
+
const [values] = await this.valuesToDb(localSearch);
|
|
62
63
|
if (exports.DEBUG)
|
|
63
64
|
console.log('SELECT COUNT(*) FROM `' + depends.storeOf(type) + '`' + sql, JSON.stringify(values));
|
|
64
65
|
const row = (await connection.query('SELECT COUNT(*) `count` FROM `' + depends.storeOf(type) + '`' + sql, Object.values(values)))[0];
|
|
@@ -334,9 +335,10 @@ class Mysql extends storage_1.DataSource {
|
|
|
334
335
|
sortOption = option.properties.length ? option : new storage_3.Sort((0, sort_2.sortOf)(type));
|
|
335
336
|
}
|
|
336
337
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
const
|
|
338
|
+
const localSearch = { ...search };
|
|
339
|
+
Object.setPrototypeOf(localSearch, type.prototype);
|
|
340
|
+
const sql = this.propertiesToSearchSql(localSearch);
|
|
341
|
+
const [values] = await this.valuesToDb(localSearch);
|
|
340
342
|
if (exports.DEBUG)
|
|
341
343
|
console.log('SELECT ' + propertiesSql + ' FROM `' + depends.storeOf(type) + '`' + sql, JSON.stringify(values));
|
|
342
344
|
const limit = limitOption?.limit ? ' LIMIT ' + limitOption.limit : '';
|
package/esm/mysql.js
CHANGED
|
@@ -51,9 +51,10 @@ export class Mysql extends DataSource {
|
|
|
51
51
|
}
|
|
52
52
|
async count(type, search = {}) {
|
|
53
53
|
const connection = this.connection ?? await this.connect();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
const
|
|
54
|
+
const localSearch = { ...search };
|
|
55
|
+
Object.setPrototypeOf(localSearch, type.prototype);
|
|
56
|
+
const sql = this.propertiesToSearchSql(localSearch);
|
|
57
|
+
const [values] = await this.valuesToDb(localSearch);
|
|
57
58
|
if (DEBUG)
|
|
58
59
|
console.log('SELECT COUNT(*) FROM `' + depends.storeOf(type) + '`' + sql, JSON.stringify(values));
|
|
59
60
|
const row = (await connection.query('SELECT COUNT(*) `count` FROM `' + depends.storeOf(type) + '`' + sql, Object.values(values)))[0];
|
|
@@ -329,9 +330,10 @@ export class Mysql extends DataSource {
|
|
|
329
330
|
sortOption = option.properties.length ? option : new Sort(sortOf(type));
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
const
|
|
333
|
+
const localSearch = { ...search };
|
|
334
|
+
Object.setPrototypeOf(localSearch, type.prototype);
|
|
335
|
+
const sql = this.propertiesToSearchSql(localSearch);
|
|
336
|
+
const [values] = await this.valuesToDb(localSearch);
|
|
335
337
|
if (DEBUG)
|
|
336
338
|
console.log('SELECT ' + propertiesSql + ' FROM `' + depends.storeOf(type) + '`' + sql, JSON.stringify(values));
|
|
337
339
|
const limit = limitOption?.limit ? ' LIMIT ' + limitOption.limit : '';
|
package/package.json
CHANGED