MCPcopy
hub / github.com/Effect-TS/effect / PgContainer

Class PgContainer

packages/sql-kysely/test/utils.ts:12–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10import { Context, Effect, Layer, Redacted } from "effect"
11
12export class PgContainer extends Context.Tag("test/PgContainer")<
13 PgContainer,
14 StartedPostgreSqlContainer
15>() {
16 static Live = Layer.scoped(
17 this,
18 Effect.acquireRelease(
19 Effect.promise(() => new PostgreSqlContainer("postgres:alpine").start()),
20 (container) => Effect.promise(() => container.stop())
21 )
22 )
23
24 static ClientLive = Layer.unwrapEffect(
25 Effect.gen(function*() {
26 const container = yield* PgContainer
27 return Pg.PgClient.layer({
28 url: Redacted.make(container.getConnectionUri())
29 })
30 })
31 ).pipe(Layer.provide(this.Live))
32}
33
34export class MssqlContainer extends Context.Tag("test/MssqlContainer")<
35 MssqlContainer,

Callers

nothing calls this directly

Calls 4

startMethod · 0.80
pipeMethod · 0.65
makeMethod · 0.65
provideMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…