-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
39 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Timeuuid | ||
|
||
`Timeuuid` is represented as `value::CqlTimeuuid`. | ||
`value::CqlTimeuuid` is a wrapper for `uuid::Uuid` with custom ordering logic | ||
which follows Scylla/Cassandra semantics. | ||
|
||
```rust | ||
# extern crate scylla; | ||
# use scylla::Session; | ||
# use std::error::Error; | ||
# use std::str::FromStr; | ||
# async fn check_only_compiles(session: &Session) -> Result<(), Box<dyn Error>> { | ||
use scylla::IntoTypedRows; | ||
use scylla::frame::value::CqlTimeuuid; | ||
|
||
// Insert some timeuuid into the table | ||
let to_insert: CqlTimeuuid = CqlTimeuuid::from_str("8e14e760-7fa8-11eb-bc66-000000000001")?; | ||
session | ||
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert,)) | ||
.await?; | ||
|
||
// Read timeuuid from the table | ||
if let Some(rows) = session.query("SELECT a FROM keyspace.table", &[]).await?.rows { | ||
for row in rows.into_typed::<(CqlTimeuuid,)>() { | ||
let (timeuuid_value,): (CqlTimeuuid,) = row?; | ||
} | ||
} | ||
# Ok(()) | ||
# } | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters