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

feat: add to_url_lossy to connect options #2902

Conversation

lily-mosquitoes
Copy link
Contributor

@lily-mosquitoes lily-mosquitoes commented Nov 26, 2023

Add a get_url to ConnectOptions and implement it for all needed types; add get_filename for SqliteConnectOptions. These changes make it easier to test sqlx.

Does your PR solve an issue?

Fixes #2901
Related to #2764

Add a get_url to connect options and implement it for all needed types;
include get_filename for sqlite. These changes make it easier to test
sqlx.
@lily-mosquitoes
Copy link
Contributor Author

lily-mosquitoes commented Nov 26, 2023

This code uses unwrap on the Url::parse because it seems to me that the internal state of each of the types should always be valid. Let me know if that is not acceptable however, and I could change the response signature to a Result.

@lily-mosquitoes lily-mosquitoes marked this pull request as ready for review November 26, 2023 17:54
Copy link
Collaborator

@abonander abonander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned in #2901, I'd like to see a motivating example to better understand the use-case for this, because not many tools use the same URL syntax that SQLx does.

@ahcodedthat
Copy link

See also #2097, another use case for this. Thanks for working on it!

@abonander abonander changed the title feat: add get_url to connect options feat: add to_url_lossy to connect options Feb 25, 2024
@abonander abonander merged commit b29eab0 into launchbadge:main Mar 6, 2024
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.

Get current URL from ConnecOptions
3 participants