用大整数串起js
我有一个应用程序写在节点JS和使用Sequelize JS ORM库来访问我的数据库是MySql。
我的问题是,我的数据库中有一列是BIGINT,当它的值很大时,我检索到错误的值。
例如当数据库中的值是: 10205918797953057
我得到10205918797953056
当我得到它使用sequelize。
我尝试使用big-integer
库,但我没有运气。
欢迎任何意见。
PS:我无法将数据types更改为VARCHAR。
您应该在mysql模块上启用supportBigNumbers
和可能的bigNumberStrings
: https : //github.com/felixge/node-mysql#connection-options
new Sequelize(..., { dialect: 'mysql', dialectOptions: { supportBigNumbers: true } });