paupino / rust-decimal

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

Support for mongo #623

Open opensourcegeek opened 9 months ago

opensourcegeek commented 9 months 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 8 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 8 months ago

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