Was this page helpful?
Caution
You're viewing documentation for a deprecated version of Scylla Rust Driver. Switch to the latest stable version.
Duration
is represented as CqlDuration
\
use scylla::IntoTypedRows;
use scylla::frame::value::CqlDuration;
// Insert some duration into the table
let to_insert: CqlDuration = CqlDuration { months: 1, days: 2, nanoseconds: 3 };
session
.query("INSERT INTO keyspace.table (a) VALUES(?)", (to_insert,))
.await?;
// Read duration from the table
let result = session.query("SELECT a FROM keyspace.table", &[]).await?;
let mut iter = result.rows_typed::<(CqlDuration,)>()?;
while let Some((duration_value,)) = iter.next().transpose()? {
println!("{:?}", duration_value);
}
Was this page helpful?