Fredx87 / effect-kysely

kysely adapter for effect
MIT License
22 stars 0 forks source link

Implementation of @effect/sql's Client interface #12

Open TylorS opened 4 months ago

TylorS commented 4 months ago

Hey there 👋

At first I didn't know this package existed, but I have also begun a prototype of an Effect and Kysely with a slightly different approach to things. My intent behind this issue is to see if you'd be interested in merging forces 😄

My Prototype

I have put together a prototype integration here - https://github.com/TylorS/typed/blob/ts/poc/kysely/examples/realworld/src/api/common/infrastructure/kysely.ts.

The key difference is the implementation of @effect/sql's (used to be sqlfx) Client interface here. This allows Kysely to use its drivers/dialects and configuration and we'd gain access to any libraries that will pop up supporting the @effect/sql interfaces directly, including its own.

It also provides Kysely's type-safety around the Sql.schema.* and Sql.resolver.* methods ensuring that Kysely returns at least (can have additional properties) the Encoded side of the Schema for proper conversion to the Type of the schema.

Right now I only have the postgres connection setup, but it will be quite trivial to support all of the @effect/sql-* variants as the only real change is in the @effect/sql-* Compiler interface to construct the Client, all else is the same.

Links
guillempuche commented 4 months ago

Great job! Waiting for this development to come to life ⏳