Closed RIP21 closed 1 year ago
Hey 👋
The only mention of Transaction is in API reference and it's still unclear how to use it etc.
What page/s did you land on?
Is there a plan to add such docs at some point? As for now, I'm unsure when it opens and closes transactions TBH :)
Kysely is mainly documented in code using ts doc as source of truth (turned html pages on releases). There is no plan, that I know of, to introduce documentation outside of that, and some recipes in plain markdown.
Transaction description and examples can be found here, and when using kysely in your IDE.
Transaction.execute(...)
begins a transaction using a single connection. If an error is thrown, it attempts to roll back, otherwise it attempts to commit. This is how the cake is made:
try {
await this.#props.driver.beginTransaction(connection, settings)
const result = await callback(transaction)
await this.#props.driver.commitTransaction(connection)
return result
} catch (error) {
await this.#props.driver.rollbackTransaction(connection)
throw error
}
I landed on the GitHub readme, then went to TS generated one here https://koskimas.github.io/kysely/index.html And for the search, I simply used my Ctrl + F :)
Totally forgot to check the repo files themselves to land on examples and recipes :) I see that I could've landed on recipes from README too if I would read it more carefully, but they all are still missing an answer on transactions.
Ok, now I see that I was almost there :) I haven't scrolled Transaction
docs long enough to get to transaction
method docs to see usage example :)
So, I would add a mention about it somewhere in README, as it was the only thing unclear to me that I wanted to research a bit more and failed :)
There's a search in the docs. At the top, you know, the thing that looks like a search bar.
I wasn't able to find any examples here.
The only mention of Transaction is in API reference and it's still unclear how to use it etc.
Is there a plan to add such docs at some point? As for now, I'm unsure when it opens and closes transactions TBH :)
Thanks!