pub struct DatabasePool { /* private fields */ }Expand description
Database connection pool
Implementations§
Source§impl DatabasePool
impl DatabasePool
Sourcepub async fn connect_with_config(url: &str, config: PoolConfig) -> Result<Self>
pub async fn connect_with_config(url: &str, config: PoolConfig) -> Result<Self>
Connect to database with custom configuration
Recommended settings by service type:
- High-concurrency (chat, search, order): max=25-30, min=10-15
- Medium-concurrency (auth, payment): max=20, min=5-10
- Low-concurrency (feature-flags, media): max=15, min=3-5
- One-shot binaries (extract-schema): max=1, min=0
Sourcepub async fn health_check(&self) -> Result<()>
pub async fn health_check(&self) -> Result<()>
Check database health
Trait Implementations§
Source§impl Clone for DatabasePool
impl Clone for DatabasePool
Source§fn clone(&self) -> DatabasePool
fn clone(&self) -> DatabasePool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Transactional for DatabasePool
impl Transactional for DatabasePool
Source§fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Transaction<'_>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn begin_transaction<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Transaction<'_>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Begin a transaction
Auto Trait Implementations§
impl Freeze for DatabasePool
impl !RefUnwindSafe for DatabasePool
impl Send for DatabasePool
impl Sync for DatabasePool
impl Unpin for DatabasePool
impl UnsafeUnpin for DatabasePool
impl !UnwindSafe for DatabasePool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more