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

Support for Range Types #61

Open
andre1sk opened this issue Jun 28, 2019 · 3 comments
Open

Support for Range Types #61

andre1sk opened this issue Jun 28, 2019 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@andre1sk
Copy link
Contributor

One of really nice features of PostgreSQL is range types:
tsrange — Range of timestamp without time zone
tstzrange — Range of timestamp with time zone
daterange — Range of date
int4range — Range of integer
int8range — Range of bigint
numrange — Range of numeric
https://www.postgresql.org/docs/current/rangetypes.html
would be nice to add support for them. I have time to work on this but it prob. requires a bit of discussion on TS types we would want to create for this @bartlomieju ?

@bartlomieju
Copy link
Collaborator

bartlomieju commented Jun 28, 2019

Very good idea @andre1sk! I'll need some time to work through the types solution, but feel free to open a PR with prototype so we can iterate.

EDIT: quick search for Range type in TS:
https://github.com/kgtkr/typepark/blob/master/src/list.ts#L47-L50

export type Range<A extends number, B extends number, R extends any[] = []> = {
  0: Reverse<Cons<A, R>>,
  1: Range<Inc<A>, B, Cons<A, R>>
}[A extends B ? 0 : 1];

Looks like a good starting point

@bartlomieju
Copy link
Collaborator

@andre1sk any update on this issue?

@Soremwar Soremwar self-assigned this Sep 29, 2021
@Soremwar Soremwar added the enhancement New feature or request label Sep 29, 2021
@Soremwar Soremwar added this to the v1.0.0 milestone Sep 29, 2021
@bombillazo
Copy link
Collaborator

node-postgres uses https://github.com/martianboy/postgres-range to handle these, worth taking a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants