(self, id: i32)
| 110 | } |
| 111 | |
| 112 | pub async fn delete_question(self, id: i32) -> Result<bool, Error> { |
| 113 | match sqlx::query("DELETE FROM questions WHERE id = $1") |
| 114 | .bind(id) |
| 115 | .execute(&self.connection) |
| 116 | .await |
| 117 | { |
| 118 | Ok(_) => Ok(true), |
| 119 | Err(e) => { |
| 120 | tracing::event!(tracing::Level::ERROR, "{:?}", e); |
| 121 | Err(Error::DatabaseQueryError) |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | pub async fn add_answer( |
| 127 | &self, |