MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / withDb

Function withDb

packages/core/api/src/admin/admin-users.test.ts:91–100  ·  view source on GitHub ↗
(
  body: (db: SqliteTestFumaDb) => Effect.Effect<A, E, Scope.Scope>,
)

Source from the content-addressed store, hash-verified

89// The bodies below acquire a scoped web handler, so `R` carries `Scope` rather
90// than being erased; `Effect.scoped` closes it when the body finishes.
91const withDb = <A, E>(
92 body: (db: SqliteTestFumaDb) => Effect.Effect<A, E, Scope.Scope>,
93): Effect.Effect<A, E> =>
94 Effect.scoped(
95 Effect.acquireUseRelease(
96 Effect.promise(() => createSqliteTestFumaDb({ tables: collectTables() })),
97 body,
98 (db) => Effect.promise(() => db.close()),
99 ),
100 );
101
102const insertConnection = (
103 db: SqliteTestFumaDb,

Callers 1

Calls 3

collectTablesFunction · 0.90
createSqliteTestFumaDbFunction · 0.85
closeMethod · 0.65

Tested by

no test coverage detected