-
-
Notifications
You must be signed in to change notification settings - Fork 454
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
Less painful range construction #25
Comments
I kind of like the |
That's a good point: it does seem to extend a little better to unbounded ranges. Another thought I had is to use textual tokens like II, EI, IE, EE. That is a little awkward to read though and doesn't seem to work naturally for unbounded ranges. |
I tried implementing it that way, and I ran into a problem. The ranges with no upper bound work fine, but the ranges with no lower bound won't compile and I don't understand why.
|
It tries to parse an expression first, fails and doesn't try the next option. Moving the no-lower-bound cases to the top appear to fix it. |
Yes, thank you, I had just realized that and was about to update my comment. +1 to this approach We'll also need a basic constructor for an empty range and a range unbounded on both sides. |
There's already |
I've added a macro to |
This is useful / needed to build a Rust client for the Pageserver's GetPage@LSN API, which uses CopyBoth mode.
integrate upstream
https://gist.github.com/sfackler/4c4e93f896e881fae811
I like that solution there. It is reasonably readable, does compile-time checking, and matches the postgres constructors.
However, it was also suggested on IRC to use something more like:
range!('[' a, b ')')
which is also acceptable to me.
The text was updated successfully, but these errors were encountered: