Skip to content

Instantly share code, notes, and snippets.

@cvybhu
Created September 12, 2023 12:34
Show Gist options
  • Save cvybhu/23e5964a8daef57f8a5bd70651e6793d to your computer and use it in GitHub Desktop.
Save cvybhu/23e5964a8daef57f8a5bd70651e6793d to your computer and use it in GitHub Desktop.
Print PreparedMetadata using the Rust driver for Scylla
use scylla::{Session, SessionBuilder};
#[tokio::main]
async fn main() {
let session: Session = SessionBuilder::new()
.known_node("127.0.0.1:9042")
.build()
.await
.unwrap();
session
.query("DROP KEYSPACE IF EXISTS tks", ())
.await
.unwrap();
session.query("CREATE KEYSPACE tks with replication = {'class': 'NetworkTopologyStrategy', 'replication_factor': 1}", ()).await.unwrap();
session
.query(
"CREATE TABLE tks.tab (p int, c int, PRIMARY KEY (p, c))",
(),
)
.await
.unwrap();
let prepared = session
.prepare("SELECT p FROM tks.tab WHERE p = :x AND c = :x")
.await
.unwrap();
println!("{:#?}", prepared.get_prepared_metadata());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment