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
api improve suggestion #7
Comments
Thank you for the suggestion. This is indeed a cleaner API, but it also assumes that you want to regenerate the query for every row inserted, which is often not the case. As an example, let's suppose we want to read
One could write similar code to insert objects from a slice, from a map, etc., but each use case would be slightly different. If you find yourself using a particular pattern a lot, then it may be worth writing a helper function, e.g.
So the question we need to ask is: How useful would this particular helper function be, and should we add it as a method on |
@ders so do u suggestion to create the query only once and use it repeatedly? if so, your example may need change to use a global variable, or add some comment to notice. if the query may be created every time when needed , the helper function api could be very useful. |
It's completely up to you whether you want to create the query once and reuse it, or create the query in each function or method that needs it. (It's just a string, after all!) The point about |
get it, keep it simple, tks~ |
Actual API
Expected API
And the same for update api.
The text was updated successfully, but these errors were encountered: