pub struct ConnectionManager { /* private fields */ }Expand description
Postgres connection pool with automatic database creation.
If auto_create_db is enabled (default) and the target database doesn’t
exist, it connects to the postgres system database and creates it.
Implementations§
Source§impl ConnectionManager
impl ConnectionManager
Sourcepub async fn connect(config: DbkitConfig) -> Result<Self, DbkitError>
pub async fn connect(config: DbkitConfig) -> Result<Self, DbkitError>
Connect using a DbkitConfig.
Sourcepub async fn new(url: &str) -> Result<Self, DbkitError>
pub async fn new(url: &str) -> Result<Self, DbkitError>
Connect using a connection URL with default settings.
Shorthand for ConnectionManager::connect(DbkitConfig::from_url(url)).
Sourcepub async fn get_connection(&self) -> Result<Object, DbkitError>
pub async fn get_connection(&self) -> Result<Object, DbkitError>
Get a connection from the pool.
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if the database is reachable.
Sourcepub fn connection_string(&self) -> &str
pub fn connection_string(&self) -> &str
The full connection string.
Sourcepub fn config(&self) -> &DbkitConfig
pub fn config(&self) -> &DbkitConfig
The config used to create this connection.
Sourcepub fn pool_status(&self) -> PoolStatus
pub fn pool_status(&self) -> PoolStatus
Pool health metrics.
Auto Trait Implementations§
impl Freeze for ConnectionManager
impl !RefUnwindSafe for ConnectionManager
impl Send for ConnectionManager
impl Sync for ConnectionManager
impl Unpin for ConnectionManager
impl UnsafeUnpin for ConnectionManager
impl !UnwindSafe for ConnectionManager
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