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

Get the PoolOptions from Pool #1853

Closed
Thomasdezeeuw opened this issue May 4, 2022 · 3 comments
Closed

Get the PoolOptions from Pool #1853

Thomasdezeeuw opened this issue May 4, 2022 · 3 comments

Comments

@Thomasdezeeuw
Copy link
Contributor

Title says it all, would it be possible to get the PoolOptions from Pool as it's stored in SharedPool.

My use case is that we need to create a new pool with the same options from an existing pool. We currently pass along the connection options, but since Pool already holds the options might as well use it.

@Nukesor
Copy link
Contributor

Nukesor commented Jun 6, 2022

Hey!

I currently have the same issue, but it's a bit more convoluted.

We have a quite sophisticated test setup, where we create a SQLx Pool for each test inside a Rocket instance, which is then passed to each test via an rstest fixture.

The idea is to now remove the respective test database for each test once it finished.

To achieve this, we would have to pass the database URL through all fixtures, into the function and to the cleanup function, so we can know which DB to delete.

The most ergonomic way would definitely be to just get the PoolOptions from the Pool directly (obviously non-mutable).

If this is something you could imagine, I would be happy to open a PR.

@Thomasdezeeuw
Copy link
Contributor Author

@Nukesor I haven't had a response in over a month, so maybe the best way forward is to open a pr and see how the maintainers react to that. 👍

@abonander
Copy link
Collaborator

Closed by #1897 (there was some confusion as to whether that PR addressed this or not but the final version does.)

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

3 participants