Execute a query with a cached connection Arc (avoids HashMap lookup)
(
&self,
conn_arc: &Arc<Mutex<Connection>>,
f: F
)
| 129 | |
| 130 | /// Execute a query with a cached connection Arc (avoids HashMap lookup) |
| 131 | pub fn execute_with_cached_connection<F, R>( |
| 132 | &self, |
| 133 | conn_arc: &Arc<Mutex<Connection>>, |
| 134 | f: F |
| 135 | ) -> Result<R, PgSqliteError> |
| 136 | where |
| 137 | F: FnOnce(&Connection) -> Result<R, rusqlite::Error> |
| 138 | { |
| 139 | let conn = conn_arc.lock(); |
| 140 | f(&conn).map_err(PgSqliteError::Sqlite) |
| 141 | } |
| 142 | |
| 143 | /// Remove a connection when session ends |
| 144 | pub fn remove_connection(&self, session_id: &Uuid) { |
no outgoing calls
no test coverage detected