Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SerializeCql is not implemented for DateTime<Utc> #1042

Open
amraaone opened this issue Jul 19, 2024 · 1 comment
Open

SerializeCql is not implemented for DateTime<Utc> #1042

amraaone opened this issue Jul 19, 2024 · 1 comment
Assignees
Labels
waiting-on-author Waiting for a response from issue/PR author

Comments

@amraaone
Copy link

Timestamp <—-> value::CqlTimestamp, chrono::DateTime, time::OffsetDateTime

CREATE TABLE mykeyspace.users ( id uuid PRIMARY KEY, created_at timestamp, email text, password text, salt text, username text ) WITH bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'ALL'} AND comment = '' AND compaction = {'class': 'SizeTieredCompactionStrategy'} AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND default_time_to_live = 0 AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND speculative_retry = '99.0PERCENTILE';

that created_at column how to set data? I tried these
let now = Utc::now(); let created_at = CqlTimestamp(now.timestamp_millis());

but this Utc::now() is cannot SELECT query works after when row.unwrap panicking my actix project.

how to efficiently set and select?

@Lorak-mmk
Copy link
Collaborator

There is such an implementation: https://docs.rs/scylla/latest/scylla/serialize/value/trait.SerializeCql.html#impl-SerializeCql-for-DateTime%3CUtc%3E
Did you enable feature chrono on the scylla crate?

Note: in next major release this feature will be renamed to chrono-04.

@Lorak-mmk Lorak-mmk added the waiting-on-author Waiting for a response from issue/PR author label Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-on-author Waiting for a response from issue/PR author
Projects
None yet
Development

No branches or pull requests

2 participants