#tokio #query #gel-tokio

gel-tokio

Gel database client implementation for tokio. Formerly published as gel-tokio

23 releases (4 breaking)

new 0.10.12 Apr 15, 2025
0.10.11 Apr 14, 2025
0.10.4 Mar 24, 2025
0.9.6 Feb 27, 2025
0.5.1 Jan 14, 2025

#509 in Database interfaces

Download history 67/week @ 2025-01-09 160/week @ 2025-01-16 4/week @ 2025-01-30 29/week @ 2025-02-06 19/week @ 2025-02-13 888/week @ 2025-02-20 1667/week @ 2025-02-27 1324/week @ 2025-03-06 1593/week @ 2025-03-13 1897/week @ 2025-03-20 1357/week @ 2025-03-27 2077/week @ 2025-04-03 2364/week @ 2025-04-10

8,095 downloads per month

MIT/Apache

170KB
3.5K SLoC

Gel Rust Binding for Tokio

Async client for the Gel database, using Tokio runtime.

Example Usage

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let conn = gel_tokio::create_client().await?;
    let val = conn.query_required_single::<i64, _>(
        "SELECT 7*8",
        &(),
    ).await?;
    println!("7*8 is: {}", val);
    Ok(())
}

Transaction Example

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    let conn = gel_tokio::create_client().await?;
    let val = conn.transaction(|mut transaction| async move {
        transaction.query_required_single::<i64, _>(
            "SELECT (UPDATE Counter SET { value := .value + 1}).value LIMIT 1",
            &()
        ).await
    }).await?;
    println!("Counter: {val}");
    Ok(())
}

More examples on github

License

Licensed under either of

at your option.

Dependencies

~26–38MB
~683K SLoC