nevill / zongji

A mysql binlog listener running on Node.js.
Other
376 stars 118 forks source link

Full Support for MySQL BIGINT #108

Closed vlasky closed 5 years ago

vlasky commented 5 years ago

Native JavaScript BigInt support was added to Node.js 10.4. This means that Zongji can now provide complete support for MySQL BIGINTs.

At the moment, the docs warn that:

While 64-bit integers in MySQL (BIGINT type) allow values in the range of 264 (± ½ × 264 for signed values), Javascript's internal storage of numbers limits values to 253, making the allowed range of BIGINT fields only -9007199254740992 to 9007199254740992. Unsigned 64-bit integers must also not exceed 9007199254740992.

I suggest that zongi use the BigInteger.js module which operates as polyfill for versions of Node.js prior to 10.4, otherwise it works as a thin wrapper around the native JavaScript BigInt.

nevill commented 5 years ago

We were thinking of using package Long, seems BigInteger.js is a better alternative.