steid

@jamesgill /

390 BCode·Blame·Raw
0d12f7dfeat: config from env and SQLite pool in app context1mo
1use sqlx::SqlitePool;
2use sqlx::sqlite::SqlitePoolOptions;
3
4/// Opens the SQLite pool.
5///
6/// The pool is cheap to clone and shared by reference across every request, so it is
7/// registered once as Topcoat app context rather than rebuilt per handler.
8pub async fn connect(database_url: &str) -> Result<SqlitePool, sqlx::Error> {
9 SqlitePoolOptions::new().connect(database_url).await
10}