MCPcopy Create free account
hub / github.com/Effect-TS/effect / make

Function make

packages/sql/pg/src/PgClient.ts:281–292  ·  view source on GitHub ↗
(
  options: PgPoolConfig<R>
)

Source from the content-addressed store, hash-verified

279 * @since 4.0.0
280 */
281export 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.

Callers 2

layerFunction · 0.70

Calls 6

makeConnectionFunction · 0.85
makeMethod · 0.65
useMethod · 0.65
makeImplFunction · 0.50
fFunction · 0.50
mapMethod · 0.45

Tested by

no test coverage detected