Was this page helpful?
Caution
You're viewing documentation for an unstable version of Scylla Rust Driver. Switch to the latest stable version.
Tuple
is represented as rust tuples of max 16 elements.
use scylla::IntoTypedRows;
// Insert a tuple of int and string into the table
let to_insert: (i32, String) = (1, "abc".to_string());
session
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert,))
.await?;
// Read a tuple of int and string from the table
if let Some(rows) = session.query("SELECT a FROM keyspace.table", &[]).await?.rows {
for row in rows.into_typed::<((i32, String),)>() {
let (tuple_value,): ((i32, String),) = row?;
let int_value: i32 = tuple_value.0;
let string_value: String = tuple_value.1;
}
}
Was this page helpful?