Remote / foldkit-remote-drizzle
runStatement
function · packages/remote-drizzle/src/index.ts:306
function runStatement<A>(
statement: () => PromiseLike<A>,
failed: string,
): Effect.Effect<A, RemoteServerError>A statement, failing as a RemoteServerError that says only failed. The
driver's error carries the SQL and its parameters: it is logged for
operators and never sent, where a defect would reach the client over RPC.
Run every statement a handler makes through it.
ts
yield* runStatement(() => db.update(posts).set({ title }).where(eq(posts.id, id)), 'Database write failed')