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

Using Queryable for transactions? #77

Closed
moltar opened this issue Mar 12, 2021 · 4 comments
Closed

Using Queryable for transactions? #77

moltar opened this issue Mar 12, 2021 · 4 comments
Assignees

Comments

@moltar
Copy link

moltar commented Mar 12, 2021

Can pg.Pool be Queryable by any chance?

txnClientOrPool: pg.Pool | TxnClient<IsolationSatisfying<M>>,

export type Queryable = pg.ClientBase | pg.Pool;

There's the call to release method in the finally block, which is not available on pg.Client, but maybe that can be worked around?

txnClient.release();

@jawj
Copy link
Owner

jawj commented Mar 16, 2021

Hi @moltar. I'm a bit lost: from the excerpts you've shown, pg.Pool is already a member of Queryable. Can you explain what you're looking for here a bit more slowly/completely? Thanks.

@moltar
Copy link
Author

moltar commented Mar 16, 2021

I'd like to be able to pass pg.ClientBase instance instead of pg.Pool instance.

@tetchel
Copy link

tetchel commented Dec 15, 2021

@jawj I agree with the author here and from a short look at the code I do not see any reason this would not be possible.

Would you accept a PR with this change?

jawj added a commit that referenced this issue May 5, 2022
@jawj
Copy link
Owner

jawj commented May 7, 2022

As of 5.0.3 it's now possible to pass a connected client instead of a pool to the transaction helper and friends (serializable, etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants