You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit goes over all unadjusted examples and changes them to use
the new deserialization framework. Again, it contains a lot of changes,
but they are quite simple.
Co-authored-by: Wojciech Przytuła <[email protected]>
let session:Session = SessionBuilder::new().known_node(args.node).build().await?;
135
133
let session = Arc::new(session);
136
134
137
135
session.query_unpaged("CREATE KEYSPACE IF NOT EXISTS examples_ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}",&[]).await?;
Copy file name to clipboardExpand all lines: examples/basic.rs
+17-16Lines changed: 17 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,9 @@
1
1
use anyhow::Result;
2
-
use futures::TryStreamExt;
3
-
use scylla::macros::FromRow;
4
-
use scylla::transport::session::LegacySession;
2
+
use futures::StreamExtas _;
3
+
use futures::TryStreamExtas _;
4
+
use scylla::frame::response::result::Row;
5
+
use scylla::transport::session::Session;
6
+
use scylla::DeserializeRow;
5
7
use scylla::SessionBuilder;
6
8
use std::env;
7
9
@@ -11,7 +13,7 @@ async fn main() -> Result<()> {
11
13
12
14
println!("Connecting to {} ...", uri);
13
15
14
-
let session:LegacySession = SessionBuilder::new().known_node(uri).build_legacy().await?;
16
+
let session:Session = SessionBuilder::new().known_node(uri).build().await?;
15
17
16
18
session.query_unpaged("CREATE KEYSPACE IF NOT EXISTS examples_ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}",&[]).await?;
Copy file name to clipboardExpand all lines: examples/compare-tokens.rs
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
use anyhow::Result;
2
2
use scylla::routing::Token;
3
3
use scylla::transport::NodeAddr;
4
-
use scylla::{LegacySession,SessionBuilder};
4
+
use scylla::{Session,SessionBuilder};
5
5
use std::env;
6
6
7
7
#[tokio::main]
@@ -10,7 +10,7 @@ async fn main() -> Result<()> {
10
10
11
11
println!("Connecting to {} ...", uri);
12
12
13
-
let session:LegacySession = SessionBuilder::new().known_node(uri).build_legacy().await?;
13
+
let session:Session = SessionBuilder::new().known_node(uri).build().await?;
14
14
15
15
session.query_unpaged("CREATE KEYSPACE IF NOT EXISTS examples_ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}",&[]).await?;
Copy file name to clipboardExpand all lines: examples/cql-time-types.rs
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,10 @@
3
3
4
4
use anyhow::Result;
5
5
use chrono::{DateTime,NaiveDate,NaiveTime,Utc};
6
-
use futures::{StreamExt,TryStreamExt};
6
+
use futures::{StreamExtas _,TryStreamExtas _};
7
7
use scylla::frame::response::result::CqlValue;
8
8
use scylla::frame::value::{CqlDate,CqlTime,CqlTimestamp};
9
-
use scylla::transport::session::LegacySession;
9
+
use scylla::transport::session::Session;
10
10
use scylla::SessionBuilder;
11
11
use std::env;
12
12
@@ -16,7 +16,7 @@ async fn main() -> Result<()> {
16
16
17
17
println!("Connecting to {} ...", uri);
18
18
19
-
let session:LegacySession = SessionBuilder::new().known_node(uri).build_legacy().await?;
19
+
let session:Session = SessionBuilder::new().known_node(uri).build().await?;
20
20
21
21
session.query_unpaged("CREATE KEYSPACE IF NOT EXISTS examples_ks WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'replication_factor' : 1}",&[]).await?;
22
22
@@ -44,7 +44,7 @@ async fn main() -> Result<()> {
44
44
letmut iter = session
45
45
.query_iter("SELECT d from examples_ks.dates",&[])
46
46
.await?
47
-
.into_typed::<(NaiveDate,)>();
47
+
.rows_stream::<(NaiveDate,)>()?;
48
48
whileletSome(row_result) = iter.next().await{
49
49
let(read_date,):(NaiveDate,) = match row_result {
50
50
Ok(read_date) => read_date,
@@ -66,7 +66,7 @@ async fn main() -> Result<()> {
66
66
letmut iter = session
67
67
.query_iter("SELECT d from examples_ks.dates",&[])
68
68
.await?
69
-
.into_typed::<(time::Date,)>();
69
+
.rows_stream::<(time::Date,)>()?;
70
70
whileletSome(row_result) = iter.next().await{
71
71
let(read_date,):(time::Date,) = match row_result {
72
72
Ok(read_date) => read_date,
@@ -88,7 +88,7 @@ async fn main() -> Result<()> {
88
88
letmut iter = session
89
89
.query_iter("SELECT d from examples_ks.dates",&[])
0 commit comments