Prepares and executes the statement and maps a function over the resulting rows. Collects the resulting rows into a generic structure.
(
&self,
sql: &str,
params: impl rusqlite::Params + Send,
f: F,
)
| 374 | /// |
| 375 | /// Collects the resulting rows into a generic structure. |
| 376 | pub async fn query_map_collect<T, C, F>( |
| 377 | &self, |
| 378 | sql: &str, |
| 379 | params: impl rusqlite::Params + Send, |
| 380 | f: F, |
| 381 | ) -> Result<C> |
| 382 | where |
| 383 | T: Send + 'static, |
| 384 | C: Send + 'static + std::iter::FromIterator<T>, |
| 385 | F: Send + FnMut(&rusqlite::Row) -> Result<T>, |
| 386 | { |
| 387 | self.query_map(sql, params, f, |rows| { |
| 388 | rows.collect::<std::result::Result<C, _>>() |
| 389 | }) |
| 390 | .await |
| 391 | } |
| 392 | |
| 393 | /// Prepares and executes the statement and maps a function over the resulting rows. |
| 394 | /// |
no test coverage detected