befly 2.0.5 → 2.0.7

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly",
3
- "version": "2.0.5",
3
+ "version": "2.0.7",
4
4
  "description": "Buma - 为 Bun 专属打造的 API 接口框架核心引擎",
5
5
  "type": "module",
6
6
  "private": false,
@@ -51,5 +51,5 @@
51
51
  "README.md",
52
52
  "vitest.config.js"
53
53
  ],
54
- "gitHead": "72cd6275bd279f0b2ef552ab4b8d60e8defd777b"
54
+ "gitHead": "f6e4038c4b81010d5898b4f61c132d9ac05882f2"
55
55
  }
package/plugins/db.js CHANGED
@@ -31,7 +31,10 @@ export default {
31
31
  // 重连设置
32
32
  reconnect: true,
33
33
  // 避免连接超时
34
- keepAliveDelay: 30000
34
+ keepAliveDelay: 30000,
35
+ insertIdAsNumber: true,
36
+ decimalAsNumber: true,
37
+ bigIntAsNumber: true
35
38
  };
36
39
 
37
40
  // 创建连接池
package/utils/curd.js CHANGED
@@ -54,6 +54,10 @@ export class SqlBuilder {
54
54
  }
55
55
 
56
56
  Object.entries(whereObj).forEach(([key, value]) => {
57
+ // 跳过undefined值
58
+ if (value === undefined) {
59
+ return;
60
+ }
57
61
  if (key === '$and') {
58
62
  if (Array.isArray(value)) {
59
63
  value.forEach((condition) => this._processWhereConditions(condition));
@@ -165,6 +169,7 @@ export class SqlBuilder {
165
169
 
166
170
  where(condition, value = null) {
167
171
  if (typeof condition === 'object' && condition !== null) {
172
+ // 处理对象形式的where条件,会自动过滤undefined
168
173
  this._processWhereConditions(condition);
169
174
  } else if (value !== null) {
170
175
  this._validateParam(value);