use async_trait::async_trait; use crunch_traits::{errors::PersistenceError, EventInfo}; use sqlx::{postgres::PgPoolOptions, Pool, Postgres}; pub struct PostgresPersistence { pool: Pool, } impl PostgresPersistence { pub async fn new(dsn: &str) -> anyhow::Result { let pool = PgPoolOptions::new().max_connections(5).connect(dsn).await?; sqlx::migrate!().run(&pool).await?; Ok(Self { pool }) } } #[async_trait] impl crunch_traits::Persistence for PostgresPersistence { async fn insert(&self, event_info: &EventInfo, content: Vec) -> anyhow::Result<()> { todo!() } async fn next(&self) -> Option { todo!() } async fn get(&self, event_id: &str) -> Result)>, PersistenceError> { todo!() } async fn update_published(&self, event_id: &str) -> Result<(), PersistenceError> { todo!() } }