add: change default avatar

This commit is contained in:
trisua 2025-07-14 22:05:59 -04:00
parent 8dfd307919
commit 959a125992
6 changed files with 92 additions and 13 deletions

View file

@ -75,6 +75,26 @@ impl DataManager {
Ok(res.unwrap())
}
pub async fn get_table_row_count_where(&self, table: &str, r#where: &str) -> Result<i32> {
let conn = match self.0.connect().await {
Ok(c) => c,
Err(e) => return Err(Error::DatabaseConnection(e.to_string())),
};
let res = query_row!(
&conn,
&format!("SELECT COUNT(*)::int FROM {} {}", table, r#where),
params![],
|x| Ok(x.get::<usize, i32>(0))
);
if let Err(e) = res {
return Err(Error::DatabaseError(e.to_string()));
}
Ok(res.unwrap())
}
}
#[macro_export]