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; | |
| }), | |
| }) {} | |
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 ๐
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is the abomination Im using while waiting the native Drizzle effect package ๐
the json stringify and parse is to get to some detail only available during serialization (calling toJSON methods internally) or errors that are not exposed
result is like