scylladb_rs
is an extremely light weight Scylla SDK for interacting with it's database.
- Creating & dropping keyspaces
- Creating & dropping tables
- Creating & dropping materialized views
- Creating & dropping columns
- Creating & dropping indexes
- Inserting
- Inserting if unique
- Bulk Inserting
- Delete (only with primary keys) (all primary keys must be provided)
- Select
- Applying Filters
- Counting total records
- User defined functions (UDF)
- User defined types
- Column is equal to a value
- Column is not equal to a value
- Column is greater than a value
- Column is less than a value
- Column is greater than or equal to a value
- Column is less than or equal to a value
- Column is in a list of values
- Column is between a range of values
- Column is like a value
- Order the results
- Limit the number of rows returned
- Retrieve as a CSV
- defining partition keys
- defining clustering keys
- defining optional sorting
- defining optional ttl (time to live)
[dependencies]
scylladb_rs = "0.1.0"
use scylla::QueryResult;
use scylla::transport::errors::QueryError;
use scylladb_rs::ScyllaClient;
use scylladb_rs::query::utils::print_query_result;
async fn intiliaze_client_and_select() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let client: ScyllaClient = ScyllaClient::new(vec!["127.0.0.1"]).await?;
let select_query_1: Result<QueryResult, QueryError> = client
.query("test_keyspace", "test_table")
.select(&["name", "score"])
.eq("age", 33)
.execute()
.await;
match &select_query_1 {
Ok(query_result) => print_query_result("Query Result:", query_result),
Err(e) => println!("Query failed: {:?}", e),
}
Ok(())
}
This will initialize the Scylla Client perferm a Select query and then print the result.
More examples will be present in the docs.