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

[feat]: 是否可以提供一个配置项,不转换字段名映射关系

wmui opened this issue · comments

commented

默认是把驼峰转为下划线,虽然可以通过columnName进行命名覆盖,但是如果表很多这种方式感觉有点麻烦:

userName: {
        type: STRING,
        columnName: 'userName',
        validate: {
          notNull: true,
          notEmpty: true,
        },
      },
    userPwd: {
      type: STRING,
      columnName: 'userPwd',
      validate: {
        notNull: true,
        notEmpty: true,
      },
    },

所以希望可以通过一个配置项,允许不进行命名转换。

new Realm({
  define: { underscored: false },
});

试试这样

commented

这么做可以♪(・ω・)ノ