MCPcopy Create free account
hub / github.com/Rust-Web-Development/code / get_questions

Function get_questions

ch_07/src/routes/question.rs:11–30  ·  view source on GitHub ↗
(
    params: HashMap<String, String>,
    store: Store,
)

Source from the content-addressed store, hash-verified

9
10#[instrument]
11pub async fn get_questions(
12 params: HashMap<String, String>,
13 store: Store,
14) -> Result<impl warp::Reply, warp::Rejection> {
15 event!(target: "practical_rust_book", Level::INFO, "querying questions");
16 let mut pagination = Pagination::default();
17
18 if !params.is_empty() {
19 event!(Level::INFO, pagination = true);
20 pagination = extract_pagination(params)?;
21 }
22
23 match store
24 .get_questions(pagination.limit, pagination.offset)
25 .await
26 {
27 Ok(res) => Ok(warp::reply::json(&res)),
28 Err(e) => Err(warp::reject::custom(e)),
29 }
30}
31
32pub async fn update_question(
33 id: i32,

Callers

nothing calls this directly

Calls 2

extract_paginationFunction · 0.50
get_questionsMethod · 0.45

Tested by

no test coverage detected