Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow modifying the ctx of hooks #912

Open
stephenh opened this issue Dec 15, 2023 · 0 comments
Open

Allow modifying the ctx of hooks #912

stephenh opened this issue Dec 15, 2023 · 0 comments

Comments

@stephenh
Copy link
Collaborator

  • beforeCommit should be able to have a ctx.knex that is the currently-executing transaction
  • beforeFlush/etc should be able to have a read-only ctx.knex to prevent writes that aren't during the transaction

Basically idea is to one-time codegen a per-project src/entities/EntityManager.ts that looks like:

export class EntityManager extends JoistEntityManager<MyContext> {
  createReadContext(context: MyContext) MyContext;
  createWriteContext(context: MyContext) MyContext;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant