sidorares / sidorares/node-mysql2
Feature request: Add an ability to trim trailing zeros in decimals
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.4k
- Forks
- 680
- Avg merge
- 9h 7m
- Merged PRs (30d)
- 59
Description
My team recently faced an issue with current decimal representation in string. Our database migrates to decimal(38,16) -- this is a pretty big decimal precision, but in real environment there could be only one record of 100k rows with such precision.
So, in most cases, we began to receive a lot of data with zero characters like 0.0000000000000000 - this value is equals to 0, but it cause to grows up memory usage and JSON size in component communications.
Therefore, I would like to propose to add an ability to trim trailing zeros in decimals and control it by passing variable to connection config.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how node-mysql2 converts MySQL decimal values to strings and how connection configuration is handled. Define the expected behavior for trimming trailing zeros, including zero values, and consider how the option should affect JSON output; the work is done when the behavior is configurable and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mysql, node.js, typescript
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100