Remote / foldkit-remote-drizzle
runStatement
function · packages/remote-drizzle/src/index.ts:434
function runStatement<A>(
statement: () => PromiseLike<A>,
failed: string,
): Effect.Effect<A, RemoteServerError>A statement, failing as a RemoteServerError whose message is failed and
whose cause is the driver's error. That error carries the SQL and its
parameters: it is reported for operators (StatementFailed, and the
server's ServerDefect), and the caller reads "Internal error". Run every
statement a handler makes through it.
ts
yield* runStatement(() => db.update(posts).set({ title }).where(eq(posts.id, id)), 'Database write failed')