Skip to content

Instantly share code, notes, and snippets.

import { Prisma } from "@prisma/client";
import type { Replace, UnionToTuple } from "type-fest";
import { Effect, Option } from "effect";
import { UnknownException } from "effect/Cause";
type PrismaModelOp = Exclude<
// You can import operation types from the generated Prisma client
Operation,
| "$executeRaw"
| "$executeRawUnsafe"
@aniravi24
aniravi24 / dbconnection.ts
Last active April 26, 2025 19:04
Prisma + Effect nested transactions
import * as Context from "@effect/data/Context";
import { pipe } from "@effect/data/Function";
import * as Effect from "@effect/io/Effect";
import * as Exit from "@effect/io/Exit";
import * as Layer from "@effect/io/Layer";
import { uniqueId } from "lodash-es";
import {
Prisma,
PrismaClient,