Skip to content

Commit

Permalink
examples/udt: query_unpaged -> query_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
muzarski committed Aug 28, 2024
1 parent 82418b8 commit e365bb7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions examples/user-defined-type.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use anyhow::Result;
use futures::TryStreamExt;
use scylla::macros::FromUserType;
use scylla::{SerializeValue, Session, SessionBuilder};
use std::env;
Expand Down Expand Up @@ -49,11 +50,14 @@ async fn main() -> Result<()> {
.await?;

// And read like any normal value
let result = session
.query_unpaged("SELECT my FROM examples_ks.user_defined_type_table", &[])
.await?;
let mut iter = result.rows_typed::<(MyType,)>()?;
while let Some((my_val,)) = iter.next().transpose()? {
let mut iter = session
.query_iter(
"SELECT a, b, c FROM examples_ks.user_defined_type_table",
&[],
)
.await?
.into_typed::<(MyType,)>();
while let Some((my_val,)) = iter.try_next().await? {
println!("{:?}", my_val);
}

Expand Down

0 comments on commit e365bb7

Please sign in to comment.