forked from
slices.network/slices
Highly ambitious ATProtocol AppView service and sdks
1use sqlx::PgPool;
2
3/// Core database client for interacting with PostgreSQL.
4///
5/// The Database struct wraps a connection pool and provides methods for
6/// all database operations across records, actors, slices, OAuth, and analytics.
7#[derive(Clone)]
8pub struct Database {
9 pub(super) pool: PgPool,
10}
11
12impl Database {
13 /// Creates a new Database instance from a connection pool.
14 pub fn new(pool: PgPool) -> Self {
15 Self { pool }
16 }
17
18 /// Creates a new Database instance from a connection pool.
19 /// Alias for `new()` for clarity in some contexts.
20 pub fn from_pool(pool: PgPool) -> Self {
21 Self::new(pool)
22 }
23}