googleapis / googleapis/google-cloud-node
Converting result set to simple types
- Dominant language
- TypeScript
- Stars
- 3.2k
- Forks
- 712
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 99
Description
Whenever results from queries come back, we usually get complex types (classes) for timestamps, decimals, dates etc. It's a big problem for us to convert those values into simple values.
Would it be an idea to have a flag in the query request, that performs this conversion?
As an example, decimals are returned like this
` price: Big { s: 1, e: 0, c: [Array], constructor: [Function] },`
We can't even use a generic function to call .toString() on these values, because then the values are represented as strings, not decimals, creating potential issues.
What do you guys do to generically handle this issue?
It's a huge problem for queries, and I'm quite surprised not more people are discussing this (I googled).
thoughts?
Cheers
### What would you like to see in the library?
A flag in queries that forces conversion to simple types
### Describe alternatives you've considered
Creating recursive functions to parse result but it's not ideal and doesn't work well. toString() converts to a string, even for decimals for example.
Contributor guide
Assessment
This issue has not been assessed yet.