1extern crate async_std;
2extern crate async_trait;
3extern crate cdrs_async;
4
5use std::pin::Pin;
6
7use async_std::task;
8use cdrs_async::{authenticators::NoneAuthenticator, query::QueryExecutor, Compression, Session};
9
10const CREATE_KS_QUERY: &'static str = r#"
11 CREATE KEYSPACE IF NOT EXISTS async_cdrs_3
12 WITH REPLICATION = {
13 'class' : 'SimpleStrategy',
14 'replication_factor' : 1
15 };
16"#;
17
18fn main() {
19 task::block_on(async {
20 let authenticator_strategy = NoneAuthenticator {};
21 let mut session = Session::connect(
22 "127.0.0.1:9042",
23 Compression::None,
24 authenticator_strategy.into(),
25 )
26 .await
27 .expect("session connect");
28 let pinned_session = Pin::new(&mut session);
29
30 let r = pinned_session.query(CREATE_KS_QUERY).await;
31 println!("Result {:?}", r);
32 });
33}