-
Notifications
You must be signed in to change notification settings - Fork 810
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
feat(mysql): handle unsigned integers #1746
Conversation
Thanks for running the CI tests. I only ran |
Ok, I've updated the branch to correctly return The tests pass and the generated code changes also look correct (no more |
@roccoblues I recently merged #1759 which is probably the source of your merge conflicts. I was surprised by the number of changes in the generated code. A quick search lead me to the MySQL docs:
The fact that we don't have a good solution for NULL uint64 types does make me want to wait on this change. |
I've updated my branch.
Same here. 😄
I understand that it's not optimal to have only the But it's your call. Maybe with generics out there will be a solution for At least we have the PR here for people to find if they run into the same problem. Thanks again for your work! |
Hi @kyleconroy , may I ask why this PR is not merged? |
Hi @kyleconroy , any updates? |
I've updated my branch with the latest changes from |
@kyleconroy Hi, could you merge this PR? |
Hello @kyleconroy , any reason why this isn't merged yet? Are there any concerns to address? Thank you for the awesome tool! |
I've merged in main to fix a merge conflict with some generated proto code, so this is technically ready to merge. I'm still concerned about the backwards incompatible changes and the fact that we don't have an answer for null types. For users with a large number of tables and queries, this could make upgrading to v1.19.0 difficult. A question for those of you waiting for this change: are you using |
This has merge conflicts again, but don't worry @roccoblues, I'm going to take this over the finish line. The plan is to update the overrides so that you can specify overrides for |
We have tables with explicit
🙏🏼 thanks! |
Alright, I've fixed the merge conflict and added support for targeting overrides at unsigned columns. If a user would like to back out of these changes, they can add the following to their configuration. {
"version": "2",
"sql": [
{
"schema": "query.sql",
"queries": "query.sql",
"engine": "mysql",
"gen": {
"go": {
"package": "db",
"out": "go",
"overrides": [
{
"db_type": "bigint",
"go_type": "int64",
"unsigned": true
}
]
}
}
}
]
} |
I haven't tried it yet, but https://github.com/lomsa-dev/gonull seems like it will work for BIGINT NULL / nullable uint64 columns.
|
A fix to the original change (#1746) that added support for unsigned integers. While this is a breaking change, it's impact should be smaller than the previous change. * fix missing unsigned param * add end-to-end test for unsigned_params
Hi,
first of all: thanks for your work on sqlc, it's really amazing!
This adds support for the
UNSIGNED
attribute in MySQL. Unfortunately we can only supportNOT NULL
columns as there are nosql.NullUInt*
types and most likely never will.We recently ran into this problem when a value from an
INT UNSIGNED NOT NULL
was to big for theint32
sqlc currently generates.Let me know what you think and if something is missing.
Thanks!