From 5dc818a1c1c6ed9804c939aa0126aa73fafd5559 Mon Sep 17 00:00:00 2001 From: realaravinth Date: Wed, 11 May 2022 12:31:04 +0530 Subject: [PATCH] feat: implemente delete account for postgres via sqlx --- db/db-sqlx-postgres/src/lib.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/db/db-sqlx-postgres/src/lib.rs b/db/db-sqlx-postgres/src/lib.rs index 0cc424f7..0688db26 100644 --- a/db/db-sqlx-postgres/src/lib.rs +++ b/db/db-sqlx-postgres/src/lib.rs @@ -129,6 +129,15 @@ impl MCDatabase for Database { res.map_err(map_register_err)?; Ok(()) } + + /// delete a user + async fn delete_user(&self, username: &str) -> DBResult<()> { + sqlx::query!("DELETE FROM mcaptcha_users WHERE name = ($1)", username) + .execute(&self.pool) + .await + .map_err(map_register_err)?; + Ok(()) + } } fn now_unix_time_stamp() -> i64 {