Skip to content

Commit

Permalink
docs: use query_iter in SELECT example in README
Browse files Browse the repository at this point in the history
We shouldn't encourage users to perform unpaged SELECTs. Normally,
SELECTs should be paged, therefore the example in README is modified
to use query_iter instead of query_unpaged.
  • Loading branch information
wprzytula committed Aug 27, 2024
1 parent dc01d0d commit 5975fa9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ The [documentation book](https://rust-driver.docs.scylladb.com/stable/index.html

## Examples
```rust
use futures::TryStreamExt;

let uri = "127.0.0.1:9042";

let session: Session = SessionBuilder::new().known_node(uri).build().await?;

let result = session.query_unpaged("SELECT a, b, c FROM ks.t", &[]).await?;
let mut iter = result.rows_typed::<(i32, i32, String)>()?;
while let Some((a, b, c)) = iter.next().transpose()? {
let raw_iter = session.query_iter("SELECT a, b, c FROM ks.t", &[]).await?;
let mut iter = raw_iter.into_typed::<(i32, i32, String)>();
while let Some((a, b, c)) = iter.try_next().await? {
println!("a, b, c: {}, {}, {}", a, b, c);
}
```
Expand Down

0 comments on commit 5975fa9

Please sign in to comment.