AlexPikalov / cdrs

Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async
Apache License 2.0
341 stars 58 forks source link

Resolve timespec deprecation #344

Closed jumbojets closed 4 years ago

jumbojets commented 4 years ago

Hope you all are doing well! This is a solution to issue #343 .

time::Timespec is deprecated in time 0.2.0 and is currently used as the rust type associated with Cassandra's timestamp datatype. This is a possible implementation using time::PrimitiveDateTime. This code builds and has great performance on a project of mine. PrimitiveDateTime has many features--including serialization--while maintaining a low profile. Consequently, I believe it would be extremely useful for many users, and may be a good choice of replacement.

However, because this pr eliminates Timespec, it is api breaking. If you have any other suggestions I can try something else out, but this is a possibility to start off with and explore.

Check out the docs for PrimitiveDateTime here to learn more about it.

jumbojets commented 4 years ago

the time crate also struct time::OffsetDateTime documented here. it may be more appropriate instead and worth checking out

AlexPikalov commented 4 years ago

Hello @jamesetaylor3,

First of all, thank you for a great PR! I think sooner or later we'll need to release a new major version because of this deprecation. So I'm about to merge your PR.

As for using OffsetDateTime instead, it's not necessary especially taking into account that we can use it along with time::PrimitiveDateTime. I don't think something blocks us here unless I'm missing something.

jumbojets commented 4 years ago

Hey @AlexPikalov.

Thank you very much! I completely agree. OffsetDateTime might not create extra value and instead add needless computer/programmer overhead. PrimitiveDateTime seems like the best choice, and the most useful.

It all looks good--thanks again!

nazar-pc commented 4 years ago

Looks like this also needs to be backported to async-tokio branch.