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

Support for TxOptions when creating a transaction #692

Open
dylangleason opened this issue Feb 16, 2022 · 2 comments
Open

Support for TxOptions when creating a transaction #692

dylangleason opened this issue Feb 16, 2022 · 2 comments
Labels
proposal A suggestion for a change, feature, enhancement, etc
Milestone

Comments

@dylangleason
Copy link

dylangleason commented Feb 16, 2022

Description

After checking the documentation, it doesn't appear that pop supports creating a transaction with TxOptions. I ran into this discovery after finding a need to explicitly set the IsolationLevel in Postgres.

If this feature is supported, it would be nice if it were more clearly documented, since it would appear to differ from the standard APIs for configuring these options.

Steps to Reproduce the Problem

  1. Attempted to find a way to specify TxOptions using code discovery tools, autocompletion
  2. Looked in the documentation to see if there was a different way to specify said options.
  3. Couldn't find anything, so posted in the #buffalo slack channel.

Expected Behavior

When invoking either pop.Connection.NewTransaction or pop.ConnectionTransaction(fn), I would expect to be able to provide TxOptions.

Actual Behavior

When invoking either pop.Connection.NewTransaction or pop.ConnectionTransaction(fn), I am unable to provide TxOptions.

Info

  • I am using Pop through Buffalo
  • Buffalo version 1.17.3 via Docker image: gobuffalo/buffalo:v0.17.3-slim
@dylangleason
Copy link
Author

dylangleason commented Feb 17, 2022

I found this in a merged PR. https://github.com/gobuffalo/pop/pull/594/files

However, this forces the programmer to deal with a lower level API, making it hard to integrate with the ORM functionality provided by pop.Connection.

Is there not a simpler way to specify transaction options?

@dylangleason
Copy link
Author

Looking at the following in connection.go, I see how one could easily expose the transaction options using the feature provided in #594. I will work on testing a solution.

@sio4 sio4 added the proposal A suggestion for a change, feature, enhancement, etc label Sep 24, 2022
@sio4 sio4 added this to the Backlog milestone Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal A suggestion for a change, feature, enhancement, etc
Projects
None yet
Development

No branches or pull requests

2 participants