Crates.io | edgedb-tokio |
lib.rs | edgedb-tokio |
version | 0.5.1 |
source | src |
created_at | 2022-01-28 16:34:04.939915 |
updated_at | 2024-05-09 16:19:15.912414 |
description | EdgeDB database client implementation for tokio. |
homepage | |
repository | |
max_upload_size | |
id | 523149 |
size | 349,010 |
Work in progress asynchronous bindings of EdgeDB for Tokio main loop.
#[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(())
}
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let conn = edgedb_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
Licensed under either of
at your option.