abdolence / firestore-rs

Google Firestore for Rust based on gRPC API with Serde serializer
Apache License 2.0
111 stars 18 forks source link

Native support for Serializing/Deserializing prost_types::Timestamp & std::time::SystemTime #187

Open markuskobler opened 3 months ago

markuskobler commented 3 months ago

I realize chrono is currently neatly integrated with firestore-rs but would there be a downside to also supporting google.protobuf.Timestamp and std::time::SystemTime when it comes to serializing and deserializing timestamps?

Would be happy to pull a PR together if you were open to this and had a preferences on how it would be implemented.

Also as an aside we have tried to stick with time instead of chrono so ideally chrono would be a default feature we could disable.

abdolence commented 2 months ago

Hey, yes, this is my long term concern as well. The time I started working with Firestore (it wasn't even published here yet), chrono was almost single choice that we had.

Nowadays, there is a plenty good choices:

Now the problem is that somehow give a choice for date/time integration (not so disruptive for the current users). Probably it needs to introduce some internal type based on something like std::time or Timestamp and optional (feature gated) conversion for different crates out there.

Of course I'm open to any contributions here, since I'm focusing a bit on different stuff for now and it would be great if someone can implement this.

abdolence commented 2 months ago

And I don't think there is no need to make chrono somehow special one (or even default one).