Crate sqlx_scylladb

Crate sqlx_scylladb 

Source
Expand description

§sqlx-scylladb

A database driver for ScyllaDB to be used with the Rust sqlx framework.

Wrap the scylla-rust-driver using the sqlx interface.

§Basic Usage

use sqlx_scylladb::ScyllaDBPoolOptions;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let pool = ScyllaDBPoolOptions::new()
        .max_connections(5)
        .connect("scylladb://localhost/test")
        .await?;

    sqlx::query("INSERT INTO users(id, name) VALUES(?, ?)")
      .bind(1)
      .bind("Alice")
      .execute(&pool)
      .await?;

    let (name,): (String,) = sqlx::query_as("SELECT name FROM users WHERE id = ?")
      .bind(1)
      .fetch_one(&pool)
      .await?;

    assert_eq!("Alice", name);

    Ok(())
}

§Features

  • Standard type binding and fetching.
  • Support for user-defined type macros.
  • #[sqlx::test] macro support.
  • Migration support using the sqlx-scylladb command-line tool.
  • TLS support.

Modules§

any
Runtime-generic database driver. any feature is required.
ext
Re-exported external crates.
macros
macros feature is required.

Structs§

ScyllaDB
ScyllaDB database driver.
ScyllaDBArgumentBuffer
An array of ScyllaDBArguments used during encoding.
ScyllaDBConnectOptions
Options and flags which can be used to configure a ScyllaDB connection.
ScyllaDBValue
Implementation of sqlx::Value for ScyllaDB.
ScyllaDBValueRef
Implementation of sqlx::ValueRef for ScyllaDB.

Enums§

ScyllaDBArgument
The enum of data types that can be handled by scylla-rust-driver.
ScyllaDBError
Represents all the ways a method can fail within ScyllaDB.
ScyllaDBTypeInfo
The enum for the supported type.

Traits§

ScyllaDBExecutor
An alias for sqlx::Executor<'_, Database = ScyllaDB>.

Type Aliases§

ScyllaDBPool
An alias for sqlx::Pool, specialized for ScyllaDB.
ScyllaDBPoolOptions
An alias for sqlx::pool::PoolOptions, specialized for ScyllaDB.