@itrocks/mysql 0.1.2 → 0.1.3
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 +4 -2
- package/esm/mysql.js +4 -2
- package/package.json +1 -1
package/cjs/mysql.js
CHANGED
|
@@ -172,7 +172,8 @@ class Mysql extends storage_1.DataSource {
|
|
|
172
172
|
const rows = await connection.query('SELECT ' + propertiesSql + ' FROM `' + depends.storeOf(type) + '` WHERE id = ?', [id]);
|
|
173
173
|
return this.valuesFromDb(rows[0], type);
|
|
174
174
|
}
|
|
175
|
-
async readCollection(object, property, type
|
|
175
|
+
async readCollection(object, property, type) {
|
|
176
|
+
type ??= new reflect_2.ReflectProperty(object, property).collectionType.elementType.type;
|
|
176
177
|
const connection = this.connection ?? await this.connect();
|
|
177
178
|
const propertiesSql = this.propertiesToSqlSelect(type);
|
|
178
179
|
const objectTable = depends.storeOf(object);
|
|
@@ -193,7 +194,8 @@ class Mysql extends storage_1.DataSource {
|
|
|
193
194
|
const rows = await connection.query(query, [object.id]);
|
|
194
195
|
return Promise.all(rows.map(row => this.valuesFromDb(row, type)));
|
|
195
196
|
}
|
|
196
|
-
async readCollectionIds(object, property, type
|
|
197
|
+
async readCollectionIds(object, property, type) {
|
|
198
|
+
type ??= new reflect_2.ReflectProperty(object, property).collectionType.elementType.type;
|
|
197
199
|
const connection = this.connection ?? await this.connect();
|
|
198
200
|
const objectTable = depends.storeOf(object);
|
|
199
201
|
const propertyTable = depends.storeOf(type);
|
package/esm/mysql.js
CHANGED
|
@@ -167,7 +167,8 @@ export class Mysql extends DataSource {
|
|
|
167
167
|
const rows = await connection.query('SELECT ' + propertiesSql + ' FROM `' + depends.storeOf(type) + '` WHERE id = ?', [id]);
|
|
168
168
|
return this.valuesFromDb(rows[0], type);
|
|
169
169
|
}
|
|
170
|
-
async readCollection(object, property, type
|
|
170
|
+
async readCollection(object, property, type) {
|
|
171
|
+
type ??= new ReflectProperty(object, property).collectionType.elementType.type;
|
|
171
172
|
const connection = this.connection ?? await this.connect();
|
|
172
173
|
const propertiesSql = this.propertiesToSqlSelect(type);
|
|
173
174
|
const objectTable = depends.storeOf(object);
|
|
@@ -188,7 +189,8 @@ export class Mysql extends DataSource {
|
|
|
188
189
|
const rows = await connection.query(query, [object.id]);
|
|
189
190
|
return Promise.all(rows.map(row => this.valuesFromDb(row, type)));
|
|
190
191
|
}
|
|
191
|
-
async readCollectionIds(object, property, type
|
|
192
|
+
async readCollectionIds(object, property, type) {
|
|
193
|
+
type ??= new ReflectProperty(object, property).collectionType.elementType.type;
|
|
192
194
|
const connection = this.connection ?? await this.connect();
|
|
193
195
|
const objectTable = depends.storeOf(object);
|
|
194
196
|
const propertyTable = depends.storeOf(type);
|
package/package.json
CHANGED