Crates.io | cdrs |
lib.rs | cdrs |
version | 4.0.0-beta.1 |
source | src |
created_at | 2016-12-07 08:33:40.503562 |
updated_at | 2021-01-29 20:57:11.140444 |
description | Cassandra DB driver written in Rust |
homepage | https://github.com/AlexPikalov/cdrs |
repository | https://github.com/AlexPikalov/cdrs |
max_upload_size | |
id | 7500 |
size | 567,782 |
CDRS is Apache Cassandra driver written in pure Rust.
đź’ˇLooking for an async version?
Add CDRS to your Cargo.toml
file as a dependency:
cdrs = { version = "2" }
Then add it as an external crate to your main.rs
:
extern crate cdrs;
use cdrs::authenticators::NoneAuthenticator;
use cdrs::cluster::session::{new as new_session};
use cdrs::cluster::{ClusterTcpConfig, NodeTcpConfigBuilder};
use cdrs::load_balancing::RoundRobin;
use cdrs::query::*;
fn main() {
let node = NodeTcpConfigBuilder::new("127.0.0.1:9042", NoneAuthenticator {}).build();
let cluster_config = ClusterTcpConfig(vec![node]);
let no_compression =
new_session(&cluster_config, RoundRobin::new()).expect("session should be created");
let create_ks: &'static str = "CREATE KEYSPACE IF NOT EXISTS test_ks WITH REPLICATION = { \
'class' : 'SimpleStrategy', 'replication_factor' : 1 };";
no_compression.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.
This project is licensed under either of
at your option.