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
pub use state::GlobalsDelta;
pub use state::ConfigDelta;
Modules
- Connection state modification utilities
Structs
- A builder used to create connections.
- EdgeDB Client
- Configuration of the client
- Error type returned from any EdgeDB call.
- This structure contains options for retrying transactions and queries
- Transaction object passed to the closure via
Client::transaction()
method - Options for
transaction()
Enums
- Client security mode.
- Parsed EdgeDB instance name.
- Specific condition for retrying queries
- TLS Client Security Mode
Functions
- Create a connection to the database with default parameters
Derive Macros
- Derive macro that allows structs and enums to be populated by database queries.