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

Function layerFrom

packages/sql/pglite/src/PgliteClient.ts:348–356  ·  view source on GitHub ↗
(
  acquire: Effect.Effect<PgliteClient, E, R>
)

Source from the content-addressed store, hash-verified

346 * @since 4.0.0
347 */
348export const layerFrom = <E, R>(
349 acquire: Effect.Effect<PgliteClient, E, R>
350): Layer.Layer<PgliteClient | Client.SqlClient, E, Exclude<R, Scope.Scope | Reactivity.Reactivity>> =>
351 Layer.effectContext(
352 Effect.map(acquire, (client) =>
353 Context.make(PgliteClient, client).pipe(
354 Context.add(Client.SqlClient, client)
355 ))
356 ).pipe(Layer.provide(Reactivity.layer)) as any
357
358/**
359 * Creates a layer from a `Config`-wrapped PGlite client configuration, providing both `PgliteClient` 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