Support a new type that represents a time interval

Moved from GitHub dgraph/3890

Posted by gitlw:

Experience Report

Note: Feature requests are judged based on user experience and modeled on Go Experience Reports. These reports should focus on the problems: they should not focus on and need not propose solutions.

What you wanted to do

As discussed in #3883 , the user is requesting to have a data type that represents a time interval.
Ideally, we should support

  • operations between a dateTime and a time interval. That is adding or subtracting the interval from a dateTime should generates another dateTime.
  • if a time interval predicate is indexed, we should support operations such as eq, gt, lt etc just like those on the int type

What you actually did

Why that wasn’t great, with examples

Any external references to support your case

MichaelJCompton commented :

This looks like a reasonable feature request.

I’m tagging it as accepted, which means it will get into our backlog of features to consider.

If we decide to implement it, we’ll post an update here.