node-mysql2
node-mysql2 copied to clipboard
Feature request: Add an ability to trim trailing zeros in decimals
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.
Thats an oddly specific flag. Before we discuss the PR a question - have you considered typeCast
? Do you want ti have your change that low for a performance reason or there are other considerations?