Description
Currently sqlc-gen-typescript maps MySQL's BIGINT type to number type, but the max value of number type is far smaller than that of BIGINT.
node-mysql2
supports big numbers by converting it to string, so sqlc should also support mapping bigint to string.
https://github.com/mysqljs/mysql#connection-options
Here's a related quote from the doc
supportBigNumbers
: When dealing with big numbers (BIGINT and DECIMAL columns) in the database, you should enable this option (Default:false
).
bigNumberStrings
: Enabling bothsupportBigNumbers
andbigNumberStrings
forces big numbers (BIGINT and DECIMAL columns) to be always returned as JavaScript String objects (Default: false). Enabling supportBigNumbers but leavingbigNumberStrings
disabled will return big numbers as String objects only when they cannot be accurately represented with [JavaScript Number objects] (https://tc39.es/ecma262/#sec-ecmascript-language-types-number-type) (which happens when they exceed the [-2^53, +2^53] range), otherwise they will be returned as Number objects. This option is ignored ifsupportBigNumbers
is disabled.
I think we can simply navigate users to enable those two options to use BIGING support.