mirror of
https://github.com/YGGverse/rssto.git
synced 2026-03-31 17:15:29 +00:00
implement contents_total method
This commit is contained in:
parent
eedc9c06fc
commit
c52f960cbe
1 changed files with 8 additions and 0 deletions
|
|
@ -118,6 +118,14 @@ impl Mysql {
|
|||
Ok(c.last_insert_id())
|
||||
}
|
||||
|
||||
pub fn contents_total(&self) -> Result<usize, Error> {
|
||||
let total: Option<usize> = self
|
||||
.pool
|
||||
.get_conn()?
|
||||
.query_first("SELECT COUNT(*) FROM `content`")?;
|
||||
Ok(total.unwrap_or(0))
|
||||
}
|
||||
|
||||
pub fn contents(&self, limit: Option<usize>) -> Result<Vec<Content>, Error> {
|
||||
self.pool.get_conn()?.query_map(
|
||||
format!(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue