use sqlx::sqlite::SqlitePool; use crate::{ error::BoxedError, repo::channel::{self, Channel, Provider as _}, }; pub struct Index<'a> { db: &'a SqlitePool, } impl<'a> Index<'a> { pub const fn new(db: &'a SqlitePool) -> Self { Self { db } } pub async fn channel(&self, channel: &channel::Id) -> Result { let mut tx = self.db.begin().await?; let channel = tx.channels().by_id(channel).await?; tx.commit().await?; Ok(channel) } }