MCPcopy Index your code
hub / github.com/Rust-Web-Development/code / is_question_owner

Method is_question_owner

ch_11/src/store.rs:57–74  ·  view source on GitHub ↗
(
        &self,
        question_id: i32,
        account_id: &AccountId,
    )

Source from the content-addressed store, hash-verified

55 }
56
57 pub async fn is_question_owner(
58 &self,
59 question_id: i32,
60 account_id: &AccountId,
61 ) -> Result<bool, Error> {
62 match sqlx::query("SELECT * from questions where id = $1 and account_id = $2")
63 .bind(question_id)
64 .bind(account_id.0)
65 .fetch_optional(&self.connection)
66 .await
67 {
68 Ok(question) => Ok(question.is_some()),
69 Err(e) => {
70 tracing::event!(tracing::Level::ERROR, "{:?}", e);
71 Err(Error::DatabaseQueryError(e))
72 }
73 }
74 }
75
76 pub async fn add_question(
77 self,

Callers 2

update_questionFunction · 0.45
delete_questionFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected