Skip to content

Commit

Permalink
docs: update uuid/timeuuid info
Browse files Browse the repository at this point in the history
  • Loading branch information
muzarski committed Dec 22, 2023
1 parent 24663ff commit ab5da80
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/source/data-types/data-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Database types and their Rust equivalents:
* `Counter` <----> `value::Counter`
* `Blob` <----> `Vec<u8>`
* `Inet` <----> `std::net::IpAddr`
* `Uuid`, `Timeuuid` <----> `uuid::Uuid`
* `Uuid` <----> `uuid::Uuid`
* `Timeuuid` <----> `value::CqlTimeuuid`
* `Date` <----> `value::CqlDate`, `chrono::NaiveDate`, `time::Date`
* `Time` <----> `value::CqlTime`, `chrono::NaiveTime`, `time::Time`
* `Timestamp` <----> `value::CqlTimestamp`, `chrono::DateTime<Utc>`, `time::OffsetDateTime`
Expand Down
6 changes: 3 additions & 3 deletions docs/source/data-types/uuid.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Uuid, Timeuuid

`Uuid` and `Timeuuid` are represented as `uuid::Uuid`
`Uuid` and `Timeuuid` are represented as `uuid::Uuid` and `value::CqlTimeuuid` respectively.

```rust
# extern crate scylla;
Expand All @@ -11,13 +11,13 @@
use scylla::IntoTypedRows;
use uuid::Uuid;

// Insert some uuid/timeuuid into the table
// Insert some uuid into the table
let to_insert: Uuid = Uuid::parse_str("8e14e760-7fa8-11eb-bc66-000000000001")?;
session
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert,))
.await?;

// Read uuid/timeuuid from the table
// Read uuid from the table
if let Some(rows) = session.query("SELECT a FROM keyspace.table", &[]).await?.rows {
for row in rows.into_typed::<(Uuid,)>() {
let (uuid_value,): (Uuid,) = row?;
Expand Down

0 comments on commit ab5da80

Please sign in to comment.