-
Notifications
You must be signed in to change notification settings - Fork 112
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
Add some examples or more documentation? #187
Comments
Hi. Yeah, I need to find time to extent the readme. Regarding the questions (in order):
|
Thank you for the thorough reply.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is very tangentially related to #186 in that I've never been totally sure of the recommended way(s) to work with mysql_async's API when it comes to abstracting and writing reusable functions.
The example in the main docs is very good for a first impression of the library, but it might be helpful to document recommended ways to work with the library for more involved code/modules. I will list a few questions/scenarios here. I'm not asking these questions to be answered here (though, that wouldn't hurt, as I'm still not 100% sure on some of them, myself). The intention is that I think it would be helpful for these questions to be answered by the documentation.
update_user
that does aSELECT FOR UPDATE
query, following by some logic, and then the actualUPDATE user SET [...]
. Obviously, these operations are required to happen in a transaction and not just any connection. Is it recommended/appropriate/optimal for the function to have a parametertx: &mut Transaction<'_>
or is there some downside to using the concrete type and we should prefer to accept a&mut Queryable
instead, even though the logic wouldn't be fully correct for aConn
argument?start_transaction
on aConn
that already has a transaction going? AFAIK, MySQL doesn't have the concept of nested transactions, but it's also not an error to execute aSTART TRANSACTION
multiple times before executing aCOMMIT
orROLLBACK
. It's fine that this library made that choice, but some "in your face" documentation should warn users about this because it does differ from native MySQL behavior. (Again, AFAIK- I could be mistaken)let loaded_payments = ...
query. Is thewith(())
call necessary?Those are just things I remembering asking myself while using this excellent library. Most of the time, I ended up needing to dig through the code to learn the answers, and I feel like it would help new users a ton to have them answered in the docs somewhere or in a Cargo examples/ directory or something.
Thanks again, and cheers!
The text was updated successfully, but these errors were encountered: