Changelog
View SourceAll notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
2.0.3
Fixed
- Use
int8rangeas the ecto type forIntegerIntervalinstead ofint4range
2.0.2
Added
- Ability to specify "bare" endpoints as arguments to
leftandrighttonew/1andnew/3
2.0.1
Fixed
- Fixed incorrect typespec for
point()generated by theInterval.__using__/1macro.
2.0.1-alpha.2
Fixed
- Fixed incorrect typespec for
new/3generated by theInterval.__using__/1macro. - Fixed
:stream_datanot marked as runtime dep inmix.exs - Fixed test
Helper.bounded_interval/3not using interval from the discrete branch
Changed
- Dialyzer not not specifying
plt_add_appsmanually. The default is fine.
2.0.1-alpha.1
Added
Interval.format/1formats an interval as a string.Interval.parse/2parses a string into an interval.- Interval module functions
format/1andparse/1that delegates to the above. - Interval callback
point_format/1for customizing how a point is formattet. - Interval callback
point_parse/1to parse a string into a point. String.Charsprotocol implemented for all builtin types, which delegates toformat/1Jason.Encoderprotocl implemented for all builtin types, which delegates toformat/1
Changed
Interval.Support.EctoTypehas been rewritten to support loading and casting from strings.Interval.Support.EctoTypeno longer depends onPostgrex, since backing type could bestring
2.0.0
No changes from alpha.2
2.0.0-alpha.2
Added
partition/2now also accepts an interval as it's second argument.
Fixed
adjacent?/2is now exposed on the interval module viadefdelegatein the using macro.
2.0.0-alpha.1 - 2025-03-10
Added
exclusive_left?/1andexclusive_right?/1adjacent?/2(which just checks for adjacency in both directions)new/1now accepts optionempty: boolean()union/2will raiseInterval.IntervalOperationErrorwhen the intervals are disjoint.
Fixed
contains?/2bug - issue #29contains?/2bug - empty interval was never contained by anything which doesn't align with Postgres.
[1.0.0] - 2025-03-04
Added
- All interval implementations now defdelegate all Interval API functions, such that you can
call e.g.
union/2on your own Interval type:MyInterval.union(a, b) - Introducing a
new/3helper that takes argumentsnew(left, right, bounds \\ "[)").
Changed
- All builtins are now suffixed with "Interval" which makes aliasing easier, e.g.
alias Interval.DateInterval - Interval modules must now implement
point_normalize/1instead ofpoint_valid?/1, which allows the module to coerce values into canonical values (i.e. -0.0 to +0.0, for OTP 27)
Deprecated
Removed
- Removed the Inspect protocol. Inspect now outputs the struct as-is.
size/1- Currently no good way of doing it generally. You can easily implement this yourself.new/1will no longer accept:unbound(this came from the Ecto.Type, but not it handles this conversion interally to not poluteInterval)
Fixed
[v0.3.4] - 2023-03-01
Added
- Added
Inspectprotocol implementation for all intervals created withuse Interval(which includes all builtin types) so they now look like#Interval.Float<[1.0, 3.0)>instead of%Interval.Float{left: {:inclusive, 1.0}, right: {:exclusive, 3.0}} - Support for intervals of
NaiveDateTime. - A Logo. For no good reason.
Changed
Deprecated
Removed
Fixed
- Fixed typespec on
size/1forInterval.DateTime - Fixed dialyzer warnings.
- Incorrect docs for
union/2(#25)
[v0.3.3] - 2022-11-22
Added
Changed
Deprecated
Removed
Fixed
- The optional dependencies was also specified as test and dev only, which is not what we want. We want them optional, but all environments.
Security
[v0.3.2] - 2022-11-22
Added
Changed
Deprecated
Removed
Fixed
- Issue #19. Could not compile when the dependant project did not have Ecto included, which was a bug.
Security
[v0.3.1] - 2022-11-21
Added
- Added type and typespecs for builtin types.
- Added additional documentation in
Interval
Changed
Deprecated
Removed
Fixed
Security
[v0.3.0] - 2022-11-21
Added
- Mostly automatic support
Ecto.Type(including for builtin interval types) left/1andright/1to extract the left and right values from the interval.- Builtin
Jason.Encodersupport. Interval.__using__optionjason_encoderfor including encoder. Defaults totrue.Interval.to_map/1to convert an Interval struct to a map suitible for JSON and similar serialization.Interval.DecimalforDecimalsupport.
Changed
Interval.__using__optiondiscreteis now optional, and defaults tofalse
Deprecated
Removed
Fixed
Security
[v0.2.0] - 2022-10-27
Added
- Allow opting out of built in implementations by configuring
:interval, Interval.Float: false - Adding
Interval.Intervalableprotocol, which allows you to define what interval implementation to use for value types. This is purely for ergonomic reasons. - Special-case for empty intervals, which doesn't require implementation-specific behaviour.
- Adding
Interval.contains_point?/2 - Adding
Interval.partition/2 - Adding
Interval.size/1
Changed
- Various
RuntimeErrors handling bad input to a function has been converted toArgumentErrors Point.previous(a)andPoint.next(a)becamepoint_step/2in theInterval.Behaviour.Interval.new/1now requires a:moduleoption of the specific implementation to use, however the implementation has anew/1that infers this when creating new intervals.
Removed
- The idea of a "zero" point was removed because it doesn't make sense for all intervals.
- Removed the
Interval.Pointprotocol in favor of a behaviour for the entire interval. - Removed
Interval.size/2
[v0.1.3] - 2022-10-12
Added
- Added
Interval.size/2. - Added parameterized typespec
Interval.t/1
Changed
- The internal
Endpointstruct has been replaced by a simple 2-tuple. - Empty intervals are now represented by two identical exclusive points.
Fixed
- Fixed a bug in
Interval.intersection/2andInterval.union/2that causes incorrect bounds in some cases.
[v0.1.2] - 2022-10-10
Fixed
- Fixed a correctness bug in intersection, where intersections between intervals containing unbounded endpoints would be incorrectly computed.