Closed fredericrous closed 1 month ago
@effect/sql-kysely@0.5.0
We cannot use transaction when instantiating @effect/sql-kysely ourselves (in order to provide a custom dialect)
it.effect("transaction", () => Effect.gen(function* (_) { const db = yield* KyselyDB db.withTransaction // withTransaction is not available
withTransaction
db
withTransaction should be available. db signature should be the patched version EffectKysely
transaction. db signature is Kysely
workaround, under src/internal/kysely.ts
src/internal/kysely.ts
edit makeWithExecute and cast db variable
makeWithExecute
export const makeWithExecute = <DB>(config: KyselyConfig) => { const db = new Kysely<DB>(config) as unknown as EffectKysely<DB> ... }
The normal withTransaction from the sql package can be used as kysley uses the connection from sql
Indeed, I think I mixed things up. We can use the normal db.transaction().execute from Kysely's
db.transaction().execute
What version of Effect is running?
@effect/sql-kysely@0.5.0
What steps can reproduce the bug?
We cannot use transaction when instantiating @effect/sql-kysely ourselves (in order to provide a custom dialect)
withTransaction
is not available as a property ofdb
What is the expected behavior?
withTransaction should be available. db signature should be the patched version EffectKysely
What do you see instead?
transaction. db signature is Kysely
Additional information
workaround, under
src/internal/kysely.ts
edit
makeWithExecute
and castdb
variable