cyjake / leoric

👑 JavaScript ORM for MySQL, PostgreSQL, and SQLite.

Home Page:https://leoric.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

属性没有 select 时 调用 .toJSON() 不应该 logger warning

chenhui5416 opened this issue · comments

commented

属性没有 select 时 调用 .toJSON() 不应该 logger warning

  toJSON() {
    const obj = {};

    for (const key in this) {
      if (this.#rawUnset.has(key)) continue;
      if (typeof this[key] !== 'function') {
        const value = this[key];
        if (value != null) {
          obj[key] = value instanceof Bone ? value.toJSON() : value;
        }
      }
    }

    return obj;
  }

看代码已经会跳过未 select 的属性,需要再看一下具体问题是啥

之前没有复现问题,unset attribute warning 也已经全局移除