【问题标题】:Sailsjs not outputting bigintSailsjs 不输出 bigint
【发布时间】:2015-11-24 16:01:55
【问题描述】:

我正在尝试使用 mysql-adapter 从 mysql 表中显示一个表 表中的ID格式如下

14482773051001000000
14482773051001000001
14482773051001000002

但是sails 会吐出每个ID,比如

14482773051001000000
14482773051001000000
14482773051001000000

基本上用 0 替换所有最后的数字。

我尝试过 autoPK false 并将大小设置为 64 以获取 bigint,但无济于事。

我的属性当前设置如下:

 autoPK: false,
 schema: true,

  attributes: {
    id: {
  type: 'integer',
      size: 64,
      unique: true,
      autoIncrement:true,
      primaryKey: true
    },

有人可以帮忙吗? :/


回答

答案是通过 MysqlAdapter 开启 supportBigNumbers: true

mysql连接:{ 适配器:'sails-mysql', 主机:'192.168.xx', 用户:'用户名', 密码:'密码', 数据库:'myDb', 支持大数字:真 },

感谢@japel https://github.com/japel 在 gitter 上

【问题讨论】:

    标签: mysql sails.js


    【解决方案1】:

    答案是通过 MysqlAdapter 开启 supportBigNumbers: true

    myMysqlConnection: {
      adapter: 'sails-mysql',
      host: '192.168.x.x',
      user: 'username',
      password: 'password',
      database: 'myDb',
      supportBigNumbers: true
    },
    

    感谢@japel https://github.com/japel 在 gitter 上

    【讨论】:

      猜你喜欢
      • 2019-08-17
      • 2020-06-13
      • 2020-11-27
      • 1970-01-01
      • 1970-01-01
      • 2018-05-05
      • 2013-07-16
      • 2019-07-03
      • 1970-01-01
      相关资源
      最近更新 更多