Combining TypeScript Effects with Slonik Transactions
I am trying to organize a piece of code that heavily depends on https://github.com/gajus/slonik with effect. So far so good but I cannot find the way to ergonomically consume such APIs as
^ it opens a db transaction when the callback starts executing and closes it when it resolves
I have functions like
Within the
Any help would be appreciated
^ it opens a db transaction when the callback starts executing and closes it when it resolves
I have functions like
doStuff = (transaction) => Effect and doOtherStuff = (transaction) => Effect and I cannot figure out how to combine them with Effect.tryPromise(...) .tryPromise callback I cannot yield* and have to resort to Effect.runPromise for these doStuff / doOtherStuff helpers. But then I also need to manually re-bind all dependencies for these helpers from the parent effect. Alternatively I could convert my helpers to doStuff = (transaction) => Promise but then I will lose all the Effect's benefits. I have a feeling that there should be a better way of doing it but cannot figure it outAny help would be appreciated
