Crate edgedb_tokio

source ·
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

Re-exports

Modules

  • Connection state modification utilities

Structs

Enums

Functions

  • Create a connection to the database with default parameters

Derive Macros