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

Method is_question_owner

ch_10/src/store.rs:57–76  ·  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(
63 "SELECT * from questions where id = $1 and account_id = $2",
64 )
65 .bind(question_id)
66 .bind(account_id.0)
67 .fetch_optional(&self.connection)
68 .await
69 {
70 Ok(question) => Ok(question.is_some()),
71 Err(e) => {
72 tracing::event!(tracing::Level::ERROR, "{:?}", e);
73 Err(Error::DatabaseQueryError(e))
74 }
75 }
76 }
77
78 pub async fn add_question(
79 self,

Callers 2

update_questionFunction · 0.45
delete_questionFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected