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

使用字段的 dataType 来优化 sql 拼接结果

chenhui5416 opened this issue · comments

commented

比如有用户表定义如下:

class User extends Bone {
  static attributes = {
    name: STRING,
  }
}

实际查询的时候可能出现:

await User.findOne({ id: '784533' });
await User.findOne({ name: 9527 });

会出现类型不匹配的情况。目前 leoric 是将查询值的类型如实传递,但这会导致数据库执行查询时有一次额外的开销