CDRS crates.io version Build Status Build status

CDRS is looking for maintainers

CDRS - Apache Cassandra driver

CDRS is Apache Cassandra driver written in pure Rust.

đź’ˇLooking for an async version? - async-std https://github.com/AlexPikalov/cdrs-async (API is not fully compatible with https://github.com/AlexPikalov/cdrs) - tokio https://github.com/AlexPikalov/cdrs/tree/async-tokio

Features

Documentation and examples

Getting started

Add CDRS to your Cargo.toml file as a dependency:

toml cdrs = { version = "2" }

Then add it as an external crate to your main.rs:

```rust extern crate cdrs;

use cdrs::authenticators::NoneAuthenticator; use cdrs::cluster::session::{new as newsession}; use cdrs::cluster::{ClusterTcpConfig, NodeTcpConfigBuilder}; use cdrs::loadbalancing::RoundRobin; use cdrs::query::*;

fn main() { let node = NodeTcpConfigBuilder::new("127.0.0.1:9042", NoneAuthenticator {}).build(); let clusterconfig = ClusterTcpConfig(vec![node]); let nocompression = newsession(&clusterconfig, RoundRobin::new()).expect("session should be created");

let createks: &'static str = "CREATE KEYSPACE IF NOT EXISTS testks WITH REPLICATION = { \ 'class' : 'SimpleStrategy', 'replicationfactor' : 1 };"; nocompression.query(create_ks).expect("Keyspace create error"); } ```

This example configures a cluster consisting of a single node, and uses round robin load balancing and default r2d2 values for connection pool.

License

This project is licensed under either of

at your option.