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

Function layerFrom

packages/sql/pg/src/PgClient.ts:795–803  ·  view source on GitHub ↗
(
  acquire: Effect.Effect<PgClient, E, R>
)

Source from the content-addressed store, hash-verified

793 * @since 4.0.0
794 */
795export const layerFrom = <E, R>(
796 acquire: Effect.Effect<PgClient, E, R>
797): Layer.Layer<PgClient | Client.SqlClient, E, Exclude<R, Scope.Scope | Reactivity.Reactivity>> =>
798 Layer.effectContext(
799 Effect.map(acquire, (client) =>
800 Context.make(PgClient, client).pipe(
801 Context.add(Client.SqlClient, client)
802 ))
803 ).pipe(Layer.provide(Reactivity.layer)) as any
804
805/**
806 * Creates a layer from a `Config`-wrapped PostgreSQL pool configuration, providing both `PgClient` and `SqlClient`.

Callers 2

layerConfigFunction · 0.70
layerFunction · 0.70

Calls 5

pipeMethod · 0.65
makeMethod · 0.65
addMethod · 0.65
mapMethod · 0.45
provideMethod · 0.45

Tested by

no test coverage detected