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

Function withDb

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

Source from the content-addressed store, hash-verified

81// The bodies below acquire a scoped web handler, so `R` carries `Scope` rather
82// than being erased; `Effect.scoped` closes it when the body finishes.
83const withDb = <A, E>(
84 body: (db: SqliteTestFumaDb) => Effect.Effect<A, E, Scope.Scope>,
85): Effect.Effect<A, E> =>
86 Effect.scoped(
87 Effect.acquireUseRelease(
88 Effect.promise(() => createSqliteTestFumaDb({ tables: collectTables() })),
89 body,
90 (db) => Effect.promise(() => db.close()),
91 ),
92 );
93
94const insertConnection = (
95 db: SqliteTestFumaDb,

Callers 1

Calls 3

collectTablesFunction · 0.90
createSqliteTestFumaDbFunction · 0.85
closeMethod · 0.65

Tested by

no test coverage detected