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

Make the database kind queryable from AnyConnectionKind and AnyConnection #1592

Merged
merged 1 commit into from
Dec 29, 2021

Conversation

05storm26
Copy link
Contributor

No description provided.

@abonander
Copy link
Collaborator

We already merged a PR to add a way to get the AnyKind of an AnyPool, it just hasn't been released yet: https://github.com/launchbadge/sqlx/blob/master/sqlx-core/src/pool/mod.rs#L348

I don't see the point of replacing the AnyPool typedef with a custom type, that could actually be a breaking change.

Adding kind() to AnyConnection seems like a good improvement though.

@05storm26 05storm26 changed the title Make the database kind queryable from AnyConnectionKind, AnyConnection and AnyPool Make the database kind queryable from AnyConnectionKind and AnyConnection Dec 22, 2021
@05storm26
Copy link
Contributor Author

05storm26 commented Dec 22, 2021

@abonander Oh, I have missed that. (I have tried to do that same thing using just impl AnyPool for implementing a getter for AnyKind initially but didn't realize that SharedPool has the connect_options that can be used to get the actual AnyKind. So I rewrote AnyPool to be able to save the AnyKind from the connect_options during the initialization/creation. But yes it is unnecessary.)

I removed the rewrite of AnyPool and just left the addition of kind() to AnyConnectionKind and AnyConnection.

@05storm26
Copy link
Contributor Author

I have also added a kind getter to PoolConnection<crate::any::Any>

sqlx-core/src/pool/connection.rs Outdated Show resolved Hide resolved
@abonander abonander merged commit beb2100 into launchbadge:master Dec 29, 2021
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

Successfully merging this pull request may close these issues.

2 participants