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

Method get_questions

ch_11/src/store.rs:32–55  ·  view source on GitHub ↗
(
        self,
        limit: Option<i32>,
        offset: i32,
    )

Source from the content-addressed store, hash-verified

30 }
31
32 pub async fn get_questions(
33 self,
34 limit: Option<i32>,
35 offset: i32,
36 ) -> Result<Vec<Question>, Error> {
37 match sqlx::query("SELECT * from questions LIMIT $1 OFFSET $2")
38 .bind(limit)
39 .bind(offset)
40 .map(|row: PgRow| Question {
41 id: QuestionId(row.get("id")),
42 title: row.get("title"),
43 content: row.get("content"),
44 tags: row.get("tags"),
45 })
46 .fetch_all(&self.connection)
47 .await
48 {
49 Ok(questions) => Ok(questions),
50 Err(e) => {
51 tracing::event!(tracing::Level::ERROR, "{:?}", e);
52 Err(Error::DatabaseQueryError(e))
53 }
54 }
55 }
56
57 pub async fn is_question_owner(
58 &self,

Callers 1

get_questionsFunction · 0.45

Calls 1

QuestionIdClass · 0.50

Tested by

no test coverage detected