Prepares and executes the statement and maps a function over the resulting rows. Then executes the second function over the returned iterator and returns the result of that function.
(
&self,
sql: &str,
params: impl rusqlite::Params + Send,
f: F,
g: G,
)
| 350 | /// Then executes the second function over the returned iterator and returns the |
| 351 | /// result of that function. |
| 352 | pub async fn query_map<T, F, G, H>( |
| 353 | &self, |
| 354 | sql: &str, |
| 355 | params: impl rusqlite::Params + Send, |
| 356 | f: F, |
| 357 | g: G, |
| 358 | ) -> Result<H> |
| 359 | where |
| 360 | F: Send + FnMut(&rusqlite::Row) -> Result<T>, |
| 361 | G: Send + FnOnce(rusqlite::AndThenRows<F>) -> Result<H>, |
| 362 | H: Send + 'static, |
| 363 | { |
| 364 | let query_only = true; |
| 365 | self.call(query_only, move |conn| { |
| 366 | let mut stmt = conn.prepare(sql)?; |
| 367 | let res = stmt.query_and_then(params, f)?; |
| 368 | g(res) |
| 369 | }) |
| 370 | .await |
| 371 | } |
| 372 | |
| 373 | /// Prepares and executes the statement and maps a function over the resulting rows. |
| 374 | /// |
no test coverage detected