Expand description

EdgeDB client for Tokio

Main way to use EdgeDB bindings is to use Client. It encompasses connection pool to the database that is transparent for user. Individual queries can be made via methods on the client. Correlated queries are done via transactions

To create client, use create_client function (it gets database connection configuration from environment). You can also use Builder to build custom Config and create a client using that config.

Example

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

More examples on github

Structs

A builder used to create connection configuration

EdgeDB Client

Configuration of the client

Error type returned from any EdgeDB call.

Transaction object passed to the closure via Client::transaction() method

Functions

Create a connection to the database with default parameters