sidorares / sidorares/node-mysql2

Feature request: Add an ability to trim trailing zeros in decimals

Open
#2,155 1 comment 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.