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.
ScyllaDBArguments
Implementation of sqlx::Arguments for ScyllaDB.
ScyllaDBColumn
Implementation of sqlx::Column for ScyllaDB.
ScyllaDBConnectOptions
Options and flags which can be used to configure a ScyllaDB connection.
ScyllaDBConnection
Implementation of sqlx::Connection for ScyllaDB.
ScyllaDBQueryResult
Query execution result.
ScyllaDBRow
Implementation of sqlx::Row for ScyllaDB.
ScyllaDBStatement
Implementation of sqlx::Statement for ScyllaDB.
ScyllaDBTransactionManager
Implementation of [sqlx::TransactionManager] for ScyllaDB.
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.
ScyllaDBCompression
Compression methods.
ScyllaDBError
Represents all the ways a method can fail within ScyllaDB.
ScyllaDBReplicationStrategy
Replication strategy classes.
ScyllaDBTypeInfo
The enum for the supported type.

Traits§

ScyllaDBExecutor
An alias for sqlx::Executor<'_, Database = ScyllaDB>.
ScyllaDBHasArrayType
Provides information necessary to encode and decode ScyllaDB arrays as compatible Rust types.
ScyllaDBType
An alias for sqlx::Type<ScyllaDB>.

Functions§

register_any_type

Type Aliases§

ScyllaDBPool
An alias for sqlx::Pool, specialized for ScyllaDB.
ScyllaDBPoolOptions
An alias for sqlx::pool::PoolOptions, specialized for ScyllaDB.
ScyllaDBTransaction
An alias for sqlx::Transaction<'_, ScyllaDB>.