@zhin.js/database 1.0.80 → 1.0.81

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.
@@ -73,7 +73,7 @@ class TrxUpdation {
73
73
  });
74
74
  return this.trx.query(query, params)
75
75
  .then(result => {
76
- const affected = result.affectedRows ?? result.changes ?? 0;
76
+ const affected = affectedRows(result);
77
77
  return onfulfilled ? onfulfilled(affected) : affected;
78
78
  });
79
79
  }
@@ -103,11 +103,16 @@ class TrxDeletion {
103
103
  });
104
104
  return this.trx.query(query, params)
105
105
  .then(result => {
106
- const affected = result.affectedRows ?? result.changes ?? 0;
106
+ const affected = affectedRows(result);
107
107
  return onfulfilled ? onfulfilled(affected) : affected;
108
108
  });
109
109
  }
110
110
  }
111
+ function affectedRows(result) {
112
+ return typeof result === 'number'
113
+ ? result
114
+ : result.affectedRows ?? result.changes ?? 0;
115
+ }
111
116
  /**
112
117
  * 增强的事务上下文实现
113
118
  * 支持链式调用的事务操作
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/database",
3
- "version": "1.0.80",
3
+ "version": "1.0.81",
4
4
  "description": "Universal database abstraction layer for Zhin.js - supports SQLite, MySQL, PostgreSQL, MongoDB, Redis",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",