| 279 | * @since 4.0.0 |
| 280 | */ |
| 281 | export const make = <R = never>( |
| 282 | options: PgPoolConfig<R> |
| 283 | ): Effect.Effect<PgClient & Client.SqlClient, SqlError, Scope.Scope | Reactivity.Reactivity | R> => |
| 284 | Effect.flatMap(PgPool.make(options), (pool) => |
| 285 | makeImpl({ |
| 286 | acquirer: Effect.map(pool.get, makeConnection), |
| 287 | borrower: (f) => pool.use((connection) => f(makeConnection(connection))), |
| 288 | transactionAcquirer: Effect.map(pool.reserve, makeConnection), |
| 289 | listenAcquirer: pool.reserve, |
| 290 | config: options, |
| 291 | poolStats: pool.stats |
| 292 | })) |
| 293 | |
| 294 | /** |
| 295 | * Creates a scoped PostgreSQL client backed by one connection. |