Merged
Conversation
Contributor
|
This is awesome, yeah I want to merge it! Thanks for all the hard work! |
Contributor
Author
|
Glad to hear that! Happy to help if you need or have any questions to improve the PR. Thank you for this great lib |
Contributor
|
Hey @SilentVoid13. thought you might like to know all the tests are passing and this has made it to main. |
Contributor
Author
|
that's awesome, thank you for the speed! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I really enjoy welds' simple ergonomics as an ORM. However one thing I miss is sync support, as I prefer it over async in most cases. Making a whole program async just to communicate with the database isn't ideal.
This PR adds sync support via maybe_async.
This has multiple advantages:
Here is a summary of the changes I made to support sync:
welds: welds' core was already more or less async-free, it only required it to communicate withwelds-connection. Adding a bunch of#[maybe_async::maybe_async]was enough to convert it.welds-macros: changes were minimal as well, it only required a few tweaks to only emitasync fn/.awaitin the async casewelds-connections: changes are more consequent as I added a new synchronous client to use with the new sync API. It's an sqlite client using rusqliteNew features added:
__sync: internal feature used to enable/disable sync code compilationsqlite-sync: enables the sync sqlite clientfull-sync: same asfullbut for sync featuresA couple of things to note:
rusqliteversion because thelibsqlite3-sysversion was conflicting withsqlx. Maybe there's a more elegant solutionAlthough this PR might seem big, it's mostly just slapping a bunch of
#[maybe_async::maybe_async]to enable both async and sync code. Hope you'll consider merging it!