CDRS-async is an asynchronous driver for Apache Cassandra and Scylla databases.
It's still alpha but you can try it out.
LZ4, Snappy compression;
Cassandra-to-Rust data deserialization;
Pluggable authentication strategies;
ScyllaDB support;
Server events listening;
Multiple CQL version support (3, 4), full spec implementation;
Query tracing information.
Add CDRS-async to your Cargo.toml file as a dependency:
toml
cdrs-async = { version = "*" }
Then add it as an external crate to your main.rs
file:
```rust extern crate asyncstd; extern crate asynctrait; extern crate cdrs_async;
use asyncstd::{pin::Pin, task}; use cdrsasync::{authenticators::NoneAuthenticator, query::QueryExecutor, Compression, Session};
const CREATEKSQUERY: &'static str = r#" CREATE KEYSPACE IF NOT EXISTS asynccdrs3 WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }; "#;
fn main() { task::blockon(async { let authenticatorstrategy = NoneAuthenticator {}; let mut session = Session::connect( "127.0.0.1:9042", Compression::None, authenticatorstrategy.into(), ) .await .expect("session connect"); let pinnedsession = Pin::new(&mut session);
let r = pinned_session.query(CREATE_KS_QUERY).await;
println!("Result {:?}", r);
}); } ```
This project is licensed under either of