Created
July 27, 2025 19:47
-
-
Save kandros/a727135eff5840d68383b10aa33cfb52 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as PgDrizzle from "@effect/sql-drizzle/Pg"; | |
| import { PgClient } from "@effect/sql-pg"; | |
| import { Config, Effect } from "effect"; | |
| import * as schema from "~/lib/server/schema"; | |
| const PgLive = PgClient.layerConfig({ | |
| url: Config.redacted("DATABASE_URL"), | |
| }); | |
| export class DrizzleClient extends Effect.Service<DrizzleClient>()("app/DrizzleClient", { | |
| dependencies: [PgLive], | |
| effect: Effect.gen(function* () { | |
| const db = yield* PgDrizzle.make<typeof schema>({ | |
| schema: schema, | |
| }); | |
| return db; | |
| }), | |
| }) {} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thank you @kandros! I was stuck on this for a long time :)
Please update this as well when there is a better way to handle this 🙏