paupino / rust-decimal

Decimal number implementation written in pure Rust suitable for financial and fixed-precision calculations.
https://docs.rs/rust_decimal/
MIT License
1.03k stars 183 forks source link

Support for mongo #623

Open opensourcegeek opened 1 year ago

opensourcegeek commented 1 year ago

Is there a plan to support mongo natively, like how you've got a conversion at driver level to NUMERIC type? Mongo supports decimal 128, wondered if that's something this library could target as well out of the box.

paupino commented 11 months ago

It is not currently planned, however it's also not outside the realm of possibility. I'm not familiar with the mongodb write protocol so it'd require a bit of research to see how it serializes the type via the driver. At a quick glance, it could be as simple as leveraging bson and serde... but I'd need to really dig a bit deeper.

I'd be certainly open to contributions if anyone gets a chance also!

opensourcegeek commented 11 months ago

Yes, I was thinking it'll be helper functions to serialize/deserialize. I can have a look