mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 14:36:29 +03:00
Customise Display impl of ContactId
This brings the Display of ContactId in line with those of ChatId etc, which is a bit clearer is logs and such places. It also updates an SQL query to rely on the ToSql impl of ContactId rather than it's Display when building the query.
This commit is contained in:
committed by
bjoern
parent
64927190bd
commit
cc55be0b0a
13
src/sql.rs
13
src/sql.rs
@@ -797,6 +797,19 @@ async fn prune_tombstones(sql: &Sql) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Helper function to return comma-separated sequence of `?` chars.
|
||||
///
|
||||
/// Use this together with [`rusqlite::ParamsFromIter`] to use dynamically generated
|
||||
/// parameter lists.
|
||||
pub fn repeat_vars(count: usize) -> Result<String> {
|
||||
if count == 0 {
|
||||
bail!("Must have at least one repeat variable");
|
||||
}
|
||||
let mut s = "?,".repeat(count);
|
||||
s.pop(); // Remove trailing comma
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use async_std::channel;
|
||||
|
||||
Reference in New Issue
Block a user