-
Notifications
You must be signed in to change notification settings - Fork 25
Introduce Arproxy::Proxy: incompatible but keep functionalities over v0.x #34
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
lib/arproxy/config.rb
Outdated
|
|
||
| def use(proxy_class, *options) | ||
| if proxy_class.is_a?(Class) && proxy_class.ancestors.include?(Arproxy::Base) | ||
| # TODO: Add a migration guide URL |
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 will add an url like following into the error message after merging
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.
nit: How about creating a new file, say UPGRADING.md, and moving this guide there? Then we can add an URL before merging, without including a commit hash in the URL
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.
Good idea. Added UPGRADING.md 31d8af1
nekketsuuu
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.
Looks almost good to me -- just leaving some comments for confirmation
lib/arproxy/config.rb
Outdated
|
|
||
| def use(proxy_class, *options) | ||
| if proxy_class.is_a?(Class) && proxy_class.ancestors.include?(Arproxy::Base) | ||
| # TODO: Add a migration guide URL |
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.
nit: How about creating a new file, say UPGRADING.md, and moving this guide there? Then we can add an URL before merging, without including a commit hash in the URL
coord-e
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.
mostly LGTM
| end | ||
|
|
||
| def with_binds? | ||
| !!@with_binds |
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.
imo: How about defining #with_binds? as !!@binds and set binds: nil in the initializer for non-bind executions? Currently QueryContext#binds is meaningless when !with_binds? and it is less intuitive for users I think
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 also considered the same thing, but I wonder if some adapter might use binds: nil for something in the future.
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.
hmm right
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.
@nekketsuuu is correct. @with_binds is used to identify whether the target method has binds as an argument. This value needs to be managed separately from whether it is nil or not.
e.g. An execute method without binds:
with binds:
nekketsuuu
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.
Thank you!
The upgrade from v0 to v1 via #32 was not compatible with the behavior of the proxy, and did not cover the use cases of Arproxy as before.
In this PR, I have given up on backward compatibility in the proxy interface and changed the policy so that existing use cases can be covered.
In order to make users aware of this change, I have changed the base class of the proxy from
Arproxy::BasetoArproxy::Proxyand made it so that an exception is thrown when using the former.References