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.
The tracing
feature flag substitutes connections instrumented with opentelemetry. See diesel-tracing for details.
```rust use dieselconnection::{pg::getconnection, PoolError};
async fn main() -> Result<(), PoolError> { let conn = get_connection()?; } ```