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

Method is_question_owner

ch_09/src/store.rs:60–79  ·  view source on GitHub ↗
(
        &self,
        question_id: i32,
        account_id: &AccountId,
    )

Source from the content-addressed store, hash-verified

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

Callers 2

update_questionFunction · 0.45
delete_questionFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected