13 releases (4 breaking)
new 0.10.2 | Mar 18, 2025 |
---|---|
0.10.1 | Mar 13, 2025 |
0.9.6 | Feb 27, 2025 |
0.8.0 | Feb 21, 2025 |
0.5.1 |
|
#765 in Database interfaces
5,462 downloads per month
170KB
4K
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
- Apache License, Version 2.0, (./LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (./LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Dependencies
~24–53MB
~1M SLoC