Skip to content
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

Patch go-mysql to keep trailing zero in floats in json #368

Merged
merged 4 commits into from
Jan 15, 2025

Conversation

mtaner
Copy link
Contributor

@mtaner mtaner commented Nov 19, 2024

Patched json binary decoder from go-mysql library to add a custom marshal json method for the floats to keep the trailing 0.

This patch only works with mysql version 8, as mysql version 5.7 gets rid of the trailing 0 on cast...as json
Screenshot 2024-11-21 at 12 36 53.

This means that the tests added for checking that the trailing 0 is not dropped will fail for the 5.7 ruby tests so I have updated the test to ignore trailing 0 data for mysql version 5.7

Next steps are the open a PR with go-mysql highlighting that this will only work with mysql version 8 onwards (and add settings option similar to useDecimal to BinlogSyncerConfig and see what they think.

Copy link
Contributor

@driv3r driv3r left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets add a test case with something after decimal, just for completes, i.e. 52.19

@mtaner mtaner force-pushed the mt/patch-trailing-zero-json-serialisation branch from 579d72c to 41f382c Compare November 21, 2024 12:56
@mtaner mtaner marked this pull request as ready for review November 21, 2024 13:00
@mtaner mtaner changed the title Add config to keep trailing zero & patch Patch go-mysql to keep trailing zero in floats in json Nov 21, 2024
Copy link
Contributor

@Scalvando Scalvando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

@mtaner mtaner force-pushed the mt/patch-trailing-zero-json-serialisation branch from 8086a46 to bda3785 Compare December 12, 2024 08:48
@mtaner mtaner merged commit 0b2cc32 into main Jan 15, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants