Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce new deserialization API #1057

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/cqlsh-rs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use rustyline::error::ReadlineError;
use rustyline::{CompletionType, Config, Context, Editor};
use rustyline_derive::{Helper, Highlighter, Hinter, Validator};
use scylla::transport::Compression;
use scylla::{QueryResult, Session, SessionBuilder};
use scylla::{LegacyQueryResult, Session, SessionBuilder};
use std::env;

#[derive(Helper, Highlighter, Validator, Hinter)]
Expand Down Expand Up @@ -173,7 +173,7 @@ impl Completer for CqlHelper {
}
}

fn print_result(result: &QueryResult) {
fn print_result(result: &LegacyQueryResult) {
if result.rows.is_none() {
println!("OK");
return;
Expand Down
2 changes: 1 addition & 1 deletion examples/tower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct SessionService {

// A trivial service implementation for sending parameterless simple string requests to Scylla.
impl Service<scylla::query::Query> for SessionService {
type Response = scylla::QueryResult;
type Response = scylla::LegacyQueryResult;
type Error = scylla::transport::errors::QueryError;
type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>>>>;

Expand Down
12 changes: 6 additions & 6 deletions examples/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use scylla::statement::{
prepared_statement::PreparedStatement, query::Query, Consistency, SerialConsistency,
};
use scylla::tracing::TracingInfo;
use scylla::transport::iterator::RowIterator;
use scylla::QueryResult;
use scylla::transport::iterator::LegacyRowIterator;
use scylla::LegacyQueryResult;
use scylla::{Session, SessionBuilder};
use std::env;
use std::num::NonZeroU32;
Expand Down Expand Up @@ -42,7 +42,7 @@ async fn main() -> Result<()> {
query.set_serial_consistency(Some(SerialConsistency::LocalSerial));

// QueryResult will contain a tracing_id which can be used to query tracing information
let query_result: QueryResult = session.query_unpaged(query.clone(), &[]).await?;
let query_result: LegacyQueryResult = session.query_unpaged(query.clone(), &[]).await?;
let query_tracing_id: Uuid = query_result
.tracing_id
.ok_or_else(|| anyhow!("Tracing id is None!"))?;
Expand Down Expand Up @@ -79,14 +79,14 @@ async fn main() -> Result<()> {
// To trace execution of a prepared statement tracing must be enabled for it
prepared.set_tracing(true);

let execute_result: QueryResult = session.execute_unpaged(&prepared, &[]).await?;
let execute_result: LegacyQueryResult = session.execute_unpaged(&prepared, &[]).await?;
println!("Execute tracing id: {:?}", execute_result.tracing_id);

// PAGED QUERY_ITER EXECUTE_ITER
// It's also possible to trace paged queries like query_iter or execute_iter
// After iterating through all rows iterator.get_tracing_ids() will give tracing ids
// for all page queries
let mut row_iterator: RowIterator = session.query_iter(query, &[]).await?;
let mut row_iterator: LegacyRowIterator = session.query_iter(query, &[]).await?;

while let Some(_row) = row_iterator.next().await {
// Receive rows
Expand All @@ -105,7 +105,7 @@ async fn main() -> Result<()> {
batch.set_tracing(true);

// Run the batch and print its tracing_id
let batch_result: QueryResult = session.batch(&batch, ((),)).await?;
let batch_result: LegacyQueryResult = session.batch(&batch, ((),)).await?;
println!("Batch tracing id: {:?}\n", batch_result.tracing_id);

// CUSTOM
Expand Down
Loading
Loading