From c52f960cbe4a5dae1487183f4bf462d3b070e950 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 7 Jan 2026 22:33:50 +0200 Subject: [PATCH] implement `contents_total` method --- crates/mysql/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/mysql/src/lib.rs b/crates/mysql/src/lib.rs index 9e21990..87ac3ca 100644 --- a/crates/mysql/src/lib.rs +++ b/crates/mysql/src/lib.rs @@ -118,6 +118,14 @@ impl Mysql { Ok(c.last_insert_id()) } + pub fn contents_total(&self) -> Result { + let total: Option = self + .pool + .get_conn()? + .query_first("SELECT COUNT(*) FROM `content`")?; + Ok(total.unwrap_or(0)) + } + pub fn contents(&self, limit: Option) -> Result, Error> { self.pool.get_conn()?.query_map( format!(