Skip to content
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

rfc: Range & Multirange types #8161

Open
esseswann opened this issue Feb 9, 2022 · 0 comments
Open

rfc: Range & Multirange types #8161

esseswann opened this issue Feb 9, 2022 · 0 comments
Labels
k/enhancement New feature or improve an existing feature

Comments

@esseswann
Copy link

esseswann commented Feb 9, 2022

Is your proposal related to a problem?

Ranges & Multiranges are parsed inconveniently likewise other specific data type
Related to #1082

Describe the solution you'd like

Ranges should compile into GraphQL json-serializable input\output types with the following structure, using tstzrange as an example

type tstz_range_bound {
  inclusive: boolean!
  value: timestamptz ## Null indicates infinity
}

type tstz_range {
  upper: range_bound!
  lower: range_bound!
}

## multirange example
type table {
  tstz_multirange: [range!]!
}

input tstz_range_bound_input {
  inclusive: boolean!
  value: timestamptz ## Null indicates infinity
}

input tstz_range_input {
  upper: tstz_range_bound_input!
  lower: tstz_range_bound_input!
}

input tstz_range_comparison_bool_exp {
  _cnt_range: tstz_range_input! ## @>
  _ncnt_range: tstz_range_input! ## @>
  _cnt: timestamptz! ## @>
  _ncnt: timestamptz! ## @>
  ## ...so on
}

input tstz_multirange_comparison_bool_exp {
  _cnt_range: [tstz_range_input!]! ## @>
  _ncnt_range: [tstz_range_input!]! ## @>
  _cnt: timestamptz! ## @>
  _ncnt: timestamptz! ## @>
  ## ...so on
}

## and update timestamptz 
input timestamptz_comparison_exp {
  _in_range: [tstz_range_input!]! ## <@
  _nin_range: [tstz_range_input!]! ## <@
  ## ...so on
}

Such or similar fieldnames are recommended to use so there is no camelCase\snake_case controversy

Describe alternatives you've considered

Write views per table containing range\multirange columns that would return JSON or columns named like start_end

If the feature is approved, would you be willing to submit a PR?

Yes

@esseswann esseswann added the k/enhancement New feature or improve an existing feature label Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
k/enhancement New feature or improve an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant