()
| 53 | } |
| 54 | |
| 55 | pub async fn in_memory() -> Result<Self, DatabaseError> { |
| 56 | let pool = SqlitePoolOptions::new() |
| 57 | .max_connections(1) |
| 58 | .connect("sqlite::memory:") |
| 59 | .await |
| 60 | .map_err(|e| DatabaseError::ConnectionError(e.to_string()))?; |
| 61 | |
| 62 | let db = Self { pool }; |
| 63 | db.run_migrations().await?; |
| 64 | |
| 65 | Ok(db) |
| 66 | } |
| 67 | |
| 68 | pub fn pool(&self) -> &SqlitePool { |
| 69 | &self.pool |
nothing calls this directly
no test coverage detected