nodecosmos / charybdis

Rust ORM for ScyllaDB and Apache Cassandra
MIT License
134 stars 10 forks source link

Time to Live support #42

Open kakserpom opened 5 months ago

kakserpom commented 5 months ago

I would like insert_using_ttl() and update_using_ttl() operations to be added.

Also, it would be nice to be able to generate TTL(foo) in selects.

Scylla docs: https://opensource.docs.scylladb.com/stable/cql/time-to-live.html

GoranBrkuljan commented 5 months ago

Not planning it ATM, I'll assign myself when I get a chance. Meanwhile, PR is welcomed. insert_using_ttl(seconds: u32) and update_using_ttl(seconds: u32) are good.

kakserpom commented 5 months ago

I would use time::Duration.

GoranBrkuljan commented 5 months ago

TTL in scylla query is specified in seconds so I thought it's just easier. However, you are right, we could have duration and convert it in seconds within method.

DanielHe4rt commented 3 months ago

Hmm maybe I can check if there's any feature request for it at scylla-rust-driver. A native way to make it would be good tho.

It would be easier to wrap it and bring to other drivers.

GoranBrkuljan commented 3 months ago

It would be easier to wrap it and bring to other drivers.

Not sure if it will be possible as USING TTL is part of the query itself.