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

Method query_row

src/sql.rs:423–439  ·  view source on GitHub ↗

Execute a query which is expected to return one row.

(
        &self,
        query: &str,
        params: impl rusqlite::Params + Send,
        f: F,
    )

Source from the content-addressed store, hash-verified

421
422 /// Execute a query which is expected to return one row.
423 pub async fn query_row<T, F>(
424 &self,
425 query: &str,
426 params: impl rusqlite::Params + Send,
427 f: F,
428 ) -> Result<T>
429 where
430 F: FnOnce(&rusqlite::Row) -> rusqlite::Result<T> + Send,
431 T: Send + 'static,
432 {
433 let query_only = true;
434 self.call(query_only, move |conn| {
435 let res = conn.query_row(query, params, f)?;
436 Ok(res)
437 })
438 .await
439 }
440
441 /// Execute the function inside a transaction assuming that it does writes.
442 ///

Callers 15

set_config_exMethod · 0.80
update_timestampMethod · 0.80
set_name_exMethod · 0.80
addrMethod · 0.80
is_blocked_loadMethod · 0.80
add_or_lookup_exMethod · 0.80
update_chat_namesFunction · 0.80
from_msgMethod · 0.80
check_passphraseMethod · 0.80

Calls 1

callMethod · 0.80

Tested by 2

test_query_onlyFunction · 0.64