-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support mapping BIGINT to string in MySQL #15
Comments
It looks like the PostgreSQL counterpart is already treated as a string. @kyleconroy Any idea on how we handle this case? |
The default types map to the default return values for the - schema: "authors/mysql/schema.sql"
queries: "authors/mysql/query.sql"
engine: "mysql"
codegen:
- plugin: ts
out: node-mysql2/src/db
options:
runtime: node
driver: mysql2
mysql2:
big_number_strings: true
date_strings: true Do you have time to update #16 with that functionality? |
@kyleconroy sure, will do that. But I have a few questions Should we support enabling supportBigNumbers and bigNumberStrings independently? This makes things a bit harder.I think it's yes. I'm going to conditionally change bigint return type to IMO we should update
|
That's a good point. I think it's a good idea since we can generate the correct type signature.
Yeah, I really don't want to have to change that signature. We should probably move away from drivers as modules and instead have them as classes. I'll do that once #13 is merged so that we don't create too much churn. |
That sounds good to me. |
Okay, the refactor is done. The classes don't have constructors yet. |
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
I think we can simply navigate users to enable those two options to use BIGING support.
The text was updated successfully, but these errors were encountered: