3 releases (stable)
4.0.0 | Feb 28, 2023 |
---|---|
2.0.0 | Sep 8, 2022 |
2.0.0-rc.0 | Jul 30, 2022 |
#2154 in Procedural macros
68 downloads per month
Used in diesel-connection
4KB
diesel-connection
Static diesel r2d2 connection pooling.
Connection urls are provided by environment variables using env-url using the env variable DATABASE_URL
.
MAX_DB_CONNECTIONS
env sets max connections within connection pool
The dotenv
feature flag enables automatic at-most-once dotenv loading via dotenvy. This is necessary because pool statics are initialized pre-main via static_init.
use diesel_connection::{pg::get_connection, PoolError};
#[actix_rt::main]
async fn main() -> Result<(), PoolError> {
let conn = get_connection()?;
}
Dependencies
~1–1.2MB
~30K SLoC