tspace-mysql 1.2.0 → 1.2.1

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/README.md CHANGED
@@ -212,7 +212,7 @@ const user = await new DB('users')
212
212
  Running A Delete Query
213
213
  ```js
214
214
  const deleted = await new DB('users').where('id',1).delete()
215
- // deleted => true
215
+ // deleted => Boolean
216
216
  ```
217
217
  ## Database Transactions
218
218
 
@@ -300,7 +300,7 @@ Backup database, you may backup is this:
300
300
  * @param conection defalut current connection
301
301
  */
302
302
  const backup = await new DB().backup({
303
- database: 'try-to-backup', // clone current database to this
303
+ database: 'try-to-backup', // clone current database to this database
304
304
  connection ?: {
305
305
  host: 'localhost',
306
306
  port : 3306,
@@ -565,7 +565,7 @@ await new User().relations('posts')
565
565
  .relationQuery('user', (query : User) => {
566
566
  return query.relations('posts').relationQuery('posts',(query : Post)=> {
567
567
  return query.relations('comments','user')
568
- // relation n to ...n
568
+ // relation n, n, ...n
569
569
  })
570
570
  })
571
571
  })
@@ -1284,13 +1284,15 @@ class Database extends AbstractDatabase_1.default {
1284
1284
  const r = newData[pluck] || null;
1285
1285
  const hook = this.$state.get('HOOK');
1286
1286
  if (hook)
1287
- yield hook(r);
1287
+ for (let i in hook)
1288
+ yield hook[i](r);
1288
1289
  return r;
1289
1290
  }
1290
1291
  const r = (result === null || result === void 0 ? void 0 : result.shift()) || null;
1291
1292
  const hook = this.$state.get('HOOK');
1292
1293
  if (hook)
1293
- yield hook(r);
1294
+ for (let i in hook)
1295
+ yield hook[i](r);
1294
1296
  return r;
1295
1297
  });
1296
1298
  }
@@ -1337,7 +1339,8 @@ class Database extends AbstractDatabase_1.default {
1337
1339
  }
1338
1340
  const hook = this.$state.get('HOOK');
1339
1341
  if (hook)
1340
- yield hook(data);
1342
+ for (let i in hook)
1343
+ yield hook[i](data);
1341
1344
  return data;
1342
1345
  }
1343
1346
  const data = (result === null || result === void 0 ? void 0 : result.shift()) || null;
@@ -1349,7 +1352,8 @@ class Database extends AbstractDatabase_1.default {
1349
1352
  }
1350
1353
  const hook = this.$state.get('HOOK');
1351
1354
  if (hook)
1352
- yield hook(data);
1355
+ for (let i in hook)
1356
+ yield hook[i](data);
1353
1357
  return data;
1354
1358
  });
1355
1359
  }
@@ -1387,7 +1391,8 @@ class Database extends AbstractDatabase_1.default {
1387
1391
  }, []);
1388
1392
  const hook = this.$state.get('HOOK');
1389
1393
  if (hook)
1390
- yield hook(data || []);
1394
+ for (let i in hook)
1395
+ yield hook[i](data || []);
1391
1396
  return data || [];
1392
1397
  }
1393
1398
  if (this.$state.get('PLUCK')) {
@@ -1398,12 +1403,14 @@ class Database extends AbstractDatabase_1.default {
1398
1403
  }
1399
1404
  const hook = this.$state.get('HOOK');
1400
1405
  if (hook)
1401
- yield hook(newData || []);
1406
+ for (let i in hook)
1407
+ yield hook[i](newData || []);
1402
1408
  return newData || [];
1403
1409
  }
1404
1410
  const hook = this.$state.get('HOOK');
1405
1411
  if (hook)
1406
- yield hook(result || []);
1412
+ for (let i in hook)
1413
+ yield hook[i](result || []);
1407
1414
  return result || [];
1408
1415
  });
1409
1416
  }
@@ -1897,14 +1897,14 @@ class Model extends AbstractModel_1.AbstractModel {
1897
1897
  const empty = this.$utils.snakeCase(this._result(emptyData));
1898
1898
  const hook = this.$state.get('HOOK');
1899
1899
  if (hook === null || hook === void 0 ? void 0 : hook.length)
1900
- for (let i = 0; i < hook.length; i++)
1900
+ for (let i in hook)
1901
1901
  yield hook[i](empty);
1902
1902
  return empty;
1903
1903
  }
1904
1904
  const empty = this._result(emptyData);
1905
1905
  const hook = this.$state.get('HOOK');
1906
1906
  if (hook === null || hook === void 0 ? void 0 : hook.length)
1907
- for (let i = 0; i < hook.length; i++)
1907
+ for (let i in hook)
1908
1908
  yield hook[i](empty);
1909
1909
  return empty;
1910
1910
  });
@@ -1981,7 +1981,7 @@ class Model extends AbstractModel_1.AbstractModel {
1981
1981
  }
1982
1982
  const hook = this.$state.get('HOOK');
1983
1983
  if (hook === null || hook === void 0 ? void 0 : hook.length)
1984
- for (let i = 0; i < hook.length; i++)
1984
+ for (let i in hook)
1985
1985
  yield hook[i](result);
1986
1986
  return result;
1987
1987
  });
@@ -2223,13 +2223,13 @@ class Model extends AbstractModel_1.AbstractModel {
2223
2223
  this.$state.set('RESULT', result);
2224
2224
  const hook = this.$state.get('HOOK');
2225
2225
  if (hook === null || hook === void 0 ? void 0 : hook.length)
2226
- for (let i = 0; i < hook.length; i++)
2226
+ for (let i in hook)
2227
2227
  yield hook[i](result);
2228
2228
  return result;
2229
2229
  }
2230
2230
  const hook = this.$state.get('HOOK');
2231
2231
  if (hook === null || hook === void 0 ? void 0 : hook.length)
2232
- for (let i = 0; i < hook.length; i++)
2232
+ for (let i in hook)
2233
2233
  yield hook[i](result || []);
2234
2234
  return null;
2235
2235
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tspace-mysql",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "mysql query builder object relational mapping",
5
5
  "main": "dist/lib/index.js",
6
6
  "types": "dist/lib/index.d.ts",