-
Notifications
You must be signed in to change notification settings - Fork 43
Implement lock feature #204
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
Conversation
|
It's strange that one test in SQLite is failed even if it was succeeded in my It's same as below PR; |
|
Yeah SQLite is being a pain right now... Has nothing to do with your change. |
|
I wonder if this should be an optional param for all existing query methods. something like |
|
@jreinert thank you for your comments!
I see. The reason I used the word And about using optional param, because we need to pass the transaction object from the api caller, it should be like Repo.get(User, id, transaction: tx, locked: true)or # Implicitly assume that it does SELECT FOR UPDATE if transaction object is passed
Repo.get(User, id, transaction: tx)Now latter is OK but it can cause some problem if a transaction pool feature became available(I don't know it's planned or not though)(or achieve transaction pool by api callers). What do you think? |
|
Good points there. I have PR #203 on hold because there seems to be a problem using |
|
@jreinert OK, I saw the PR and understood the situation. Using the word |
|
I think the major benefit in having the optional param over using a single method called |
fridgerator
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @jreinert and creating named parameters for all Repo methods. Its not immediately obvious that .lock is only useful for all type queries.
The PR for implementing the
lockfeature.This change enables LiveTransaction to request
SELECT ~ FOR UPDATEon MySQL and Postgres.Now it returns the list of
queryablebyCrecto::Repo::Querylike:all, but/so that the class which does not have the primary key can also uses thislockfeature.e.g.