PostgreSQL connection pool that manages a collection of PostgreSQL connections.
More...
#include <relx/connection/postgresql_connection_pool.hpp>
PostgreSQL connection pool that manages a collection of PostgreSQL connections.
Definition at line 61 of file postgresql_connection_pool.hpp.
◆ ~PostgreSQLConnectionPool()
| relx::connection::PostgreSQLConnectionPool::~PostgreSQLConnectionPool |
( |
| ) |
|
Destructor that cleans up all connections.
◆ PostgreSQLConnectionPool() [1/2]
◆ PostgreSQLConnectionPool() [2/2]
◆ active_connections()
| size_t relx::connection::PostgreSQLConnectionPool::active_connections |
( |
| ) |
const |
Get the current number of active connections.
- Returns
- The number of active connections
◆ create()
Create a new connection pool.
- Note
- The pool needs to be a shared_ptr to help with pool worker lifetime management, so we only allow creation via the create() function.
- Parameters
-
| config | Configuration for the pool |
- Returns
- Shared pointer to the new pool
Definition at line 83 of file postgresql_connection_pool.hpp.
◆ get_connection()
Get a connection from the pool with automatic return when out of scope.
- Returns
- Result containing a PooledConnection or an error
◆ idle_connections()
| size_t relx::connection::PostgreSQLConnectionPool::idle_connections |
( |
| ) |
const |
Get the current number of idle connections.
- Returns
- The number of idle connections
◆ initialize()
Initialize the connection pool.
- Returns
- Result indicating success or failure
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ with_connection()
Execute a function with a connection from the pool.
- Template Parameters
-
| Func | Type of the function to execute |
- Parameters
-
| func | Function to execute with a connection |
- Returns
- Result of the function execution
Definition at line 119 of file postgresql_connection_pool.hpp.
The documentation for this class was generated from the following file: