conn_pool 2.1.9 copy "conn_pool: ^2.1.9" to clipboard
conn_pool: ^2.1.9 copied to clipboard

Manages a pool of connections based several builtin strategies.

conn_pool #

Manages a pool of connections.

Shared pool #

Creating a pool #

Pool requires an instance of ConnectionManager to open and close connections. In this article, we will use PostgresManager for demonstration purposes.

final pool = SharedPool(PostgresManager('exampleDB'), minSize: 5, maxSize: 10);

Getting connection #

Connection<PostgreSQLConnection> conn = await pool.get();
PostgreSQLConnection db = conn.connection;
await db.execute(
        "CREATE TABLE posts (id SERIAL PRIMARY KEY, name VARCHAR(255), age INT);");

Releasing the connection to the pool #

await conn.release();
1
likes
30
pub points
0%
popularity

Publisher

unverified uploader

Manages a pool of connections based several builtin strategies.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on conn_pool