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 Range datatype #57

Open
KodrAus opened this issue Feb 10, 2017 · 2 comments
Open

Support Range datatype #57

KodrAus opened this issue Feb 10, 2017 · 2 comments

Comments

@KodrAus
Copy link
Member

KodrAus commented Feb 10, 2017

This is a new datatype introduced in 5.2 for value ranges. See here.

Looks like we could represent it as:

struct DateRange<F> {
    gte: Date<DefaultDateMapping<F>>,
    lte: Date<DateRangeMapping<F>>,
}

Some things to think about:

  • Support for other bounds; gt or lt. Anything that can be represented by gt or lt can be done by gte and lte so not a big priority.

Ranges also support number types so they'll need to be added.

@KodrAus
Copy link
Member Author

KodrAus commented Apr 17, 2017

I think it's worth copying Rust's ranges, so the lower bound is gte and the upper bound is lt.

@KodrAus
Copy link
Member Author

KodrAus commented May 2, 2017

For completeness these bounds could also be represented as enums:

enum LowerBound<T> {
    LessThan(T),
    LessThanOrEqual(T),
}

enum UpperBound<T> {
    GreaterThan(T),
    GreaterThanOrEqual(T),
}

So you could choose whatever bounds you want, but won't have the invalid case of specifying both lt and lte.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant