Skip to content

hadi-xlx/scylladb_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

scylladb_rs

scylladb_rs is an extremely light weight Scylla SDK for interacting with it's database.

Database Features

  • 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

Advanced Filtering over select()

  • 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

Advanced table definition create_table()

  • defining partition keys
  • defining clustering keys
  • defining optional sorting
  • defining optional ttl (time to live)

Features

Cargo.toml

[dependencies]
scylladb_rs = "0.1.0"

Examples

Initialize the Scylla Client and perform a select query

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.

About

A WIP SDK for ScyllaDB in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages