Add date editing for posts
This commit is contained in:
@@ -75,6 +75,19 @@ impl BlogDb {
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
/// Delete post by id
|
||||
pub async fn set_post_date<S, T>(&self, id: S, date: T) -> anyhow::Result<()>
|
||||
where
|
||||
S: AsRef<str>,
|
||||
T: AsRef<str>,
|
||||
{
|
||||
sqlx::query("UPDATE posts SET date=? WHERE id=?")
|
||||
.bind(date.as_ref())
|
||||
.bind(id.as_ref())
|
||||
.execute(&self.db)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user