Packages / rupm

rs-db-driver-surrealdb-surrealdb 0.1.0

SurrealDB: surrealdb (the driver, re-exported, with a runnable example)

Install

cargo add rs-db-driver-surrealdb-surrealdb --registry rupm

In Ruststudio: Packages, search for rs-db-driver-surrealdb-surrealdb, Install.

Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-23.

Versions

README

# rs-db-driver-surrealdb-surrealdb

SurrealDB - surrealdb: the official async client

Add it with `rupm add rs-db-driver-surrealdb-surrealdb` (or `cargo add rs-db-driver-surrealdb-surrealdb --registry rupm`). The driver `surrealdb` is re-exported as `rs_db_driver_surrealdb_surrealdb::surrealdb`.

The first build takes minutes (a C or C++ library is compiled).

This driver is async: your project also needs an async runtime, for example `cargo add tokio --features macros,rt-multi-thread`.

## Example

```rust
use surrealdb::engine::any::connect;
use surrealdb::opt::auth::Root;

#[tokio::main]
async fn main() -> surrealdb::Result<()> {
    let db = connect("ws://localhost:8000").await?;
    db.signin(Root { username: "root", password: "root" }).await?;
    db.use_ns("test").use_db("test").await?;
    let mut response = db.query("RETURN 1").await?;
    let n: Option<i64> = response.take(0)?;
    println!("the server answered {n:?}");
    Ok(())
}
```