MCPcopy Create free account
hub / github.com/chatmail/core / query_map_collect

Method query_map_collect

src/sql.rs:376–391  ·  view source on GitHub ↗

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,
    )

Source from the content-addressed store, hash-verified

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 ///

Callers 7

runMethod · 0.80
query_map_vecMethod · 0.80
get_similar_chat_idsMethod · 0.80
get_message_statsFunction · 0.80
get_msg_reactionsFunction · 0.80

Calls 1

query_mapMethod · 0.80

Tested by

no test coverage detected