Something went wrong. Try again.
Highly ambitious ATProtocol AppView service and sdks forked from slices.network/slices
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546use 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<LogEntry>)` - 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<i64>, ) -> Result<Vec<crate::logging::LogEntry>, sqlx::Error> { crate::logging::get_jetstream_logs(&self.pool, slice_filter, limit).await }}