use sqlx::PgPool; /// Core database client for interacting with PostgreSQL. /// /// The Database struct wraps a connection pool and provides methods for /// all database operations across records, actors, slices, OAuth, and analytics. #[derive(Clone)] pub struct Database { pub(super) pool: PgPool, } impl Database { /// Creates a new Database instance from a connection pool. pub fn new(pool: PgPool) -> Self { Self { pool } } /// Creates a new Database instance from a connection pool. /// Alias for `new()` for clarity in some contexts. pub fn from_pool(pool: PgPool) -> Self { Self::new(pool) } /// Gets a reference to the connection pool. pub fn pool(&self) -> &PgPool { &self.pool } /// Gets jetstream logs from the database /// /// # Arguments /// * `slice_filter` - Optional slice URI to filter logs /// * `limit` - Optional maximum number of logs to return (default: 100) /// /// # Returns /// * `Ok(Vec)` - List of log entries ordered by creation time (DESC) /// * `Err(sqlx::Error)` - Database query error pub async fn get_jetstream_logs( &self, slice_filter: Option<&str>, limit: Option, ) -> Result, sqlx::Error> { crate::logging::get_jetstream_logs(&self.pool, slice_filter, limit).await } }