-
-
Notifications
You must be signed in to change notification settings - Fork 575
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
Expose discrete range types as their canonicalized value, omitting inclusive
#2272
Comments
Neat! Here's an example of a plugin that adds a codec, and registers the GraphQL types for it: If you can use the existing codec, you may be able to get away with just this bit: crystal/graphile-build/graphile-build-pg/src/plugins/PgLtreePlugin.ts Lines 76 to 97 in 8b790c8
because as the PostgreSQL docs note:
Here's where we register the range types: crystal/graphile-build/graphile-build-pg/src/plugins/PgCodecsPlugin.ts Lines 1326 to 1401 in 8b790c8
As you can see, we check to see if the type already exists and only register it if it doesn't - so you can register the type ahead of time and it should Just Work ™️. You should be able to write this as a plugin in your own codebase; and once you have it working we can look at merging it into core. Please let me know how you get on! |
Feature description
Currently, discrete range types such as
daterange
are represented as:For discrete range types, we can convert them to their canonical representation, so that the start of the range is always inclusive and the end always exclusive. Then, we can simplify the representation to just
Motivating example
We have a lot of date ranges in our schema, and would prefer to avoid pushing the requirement to deal with the
inclusive
flag to clients.Breaking changes
Yes, this would be a breaking change and should probably be optional (maybe using a smart tag).
Supporting development
I [tick all that apply]:
The text was updated successfully, but these errors were encountered: