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

Create "DrizzleOrTx" Context.Tag for Transaction Management #4361

Open
richardamare opened this issue Jan 28, 2025 · 0 comments
Open

Create "DrizzleOrTx" Context.Tag for Transaction Management #4361

richardamare opened this issue Jan 28, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@richardamare
Copy link

What is the problem this feature would solve?

Currently, managing transactions in our application requires explicit handling in each method that interacts with the database. This can lead to repetitive code and potential errors if a transaction is not properly initiated or managed. It also complicates the flow of the application, making it harder to ensure that all database operations are executed within a transaction context.

What is the feature you are proposing to solve the problem?

I propose the creation of a "DrizzleOrTx" Context.Tag that would allow developers to initiate a transaction in a main method and then yield the "DrizzleOrTx" context in any subsequent methods that are called within that transaction. This would encapsulate the transaction management, ensuring that all operations within the transaction are properly handled without the need for repetitive context passing. The feature would streamline transaction management, improve code readability, and reduce the risk of errors.

What alternatives have you considered?

  • Creating custom wrappers for each transaction could work, but it would lead to increased complexity and maintenance overhead.
  • While higher-order functions could encapsulate transaction logic, they may not provide the same level of clarity and ease of use as a dedicated context tag.
@richardamare richardamare added the enhancement New feature or request label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant