befly 2.0.6 → 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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/utils/curd.js +5 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "befly",
3
- "version": "2.0.6",
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": "01b8d370987fec610d22c1138fbd1298671da08b"
54
+ "gitHead": "f6e4038c4b81010d5898b4f61c132d9ac05882f2"
55
55
  }
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);