implement channel_item getter

This commit is contained in:
yggverse 2026-01-07 21:56:16 +02:00
parent 4af10ee153
commit 6d3aac409a

View file

@ -42,6 +42,25 @@ impl Mysql {
Ok(self.connection.last_insert_id()) Ok(self.connection.last_insert_id())
} }
pub fn channel_item(&mut self, channel_item_id: u64) -> Result<Option<ChannelItem>, Error> {
self.connection.exec_first(
"SELECT `channel_item_id`, `channel_id`, `pub_date`, `guid`, `link`, `title`, `description` FROM `channel_item` WHERE `channel_item_id` = ?",
(channel_item_id,)
).map(|row| {
row.map(|(channel_item_id, channel_id, pub_date, guid, link, title, description)| {
ChannelItem {
channel_item_id,
channel_id,
pub_date,
guid,
link,
title,
description,
}
})
})
}
pub fn channel_items_by_channel_id_guid( pub fn channel_items_by_channel_id_guid(
&mut self, &mut self,
channel_id: u64, channel_id: u64,