feat: implement update username for sqlx postgres

This commit is contained in:
realaravinth 2022-05-11 20:01:48 +05:30
parent 83f6456a59
commit f79d159468
No known key found for this signature in database
GPG key ID: AD9F0F08E855ED88

View file

@ -237,6 +237,20 @@ impl MCDatabase for Database {
Ok(())
}
/// update username
async fn update_username(&self, current: &str, new: &str) -> DBResult<()> {
sqlx::query!(
"UPDATE mcaptcha_users set name = $1
WHERE name = $2",
new,
current,
)
.execute(&self.pool)
.await
.map_err(map_register_err)?;
Ok(())
}
}
fn now_unix_time_stamp() -> i64 {