Skip to content

v1.0.0

Choose a tag to compare

@CaffeinatedCoder CaffeinatedCoder released this 10 Jun 17:58
· 14 commits to main since this release

CodoMetis.ValueRanges - initial release.

Fully functional, in-memory range types for .NET 10, covering all six value domains of PostgreSQL's built-in range types: Int32Range, Int64Range, DecimalRange, DateRange, DateTimeRange, and DateTimeOffsetRange.

Core design
Each type is a discriminated union of five sealed variants — Finite, UnboundedStart, UnboundedEnd, EmptyRange, and Infinity — encoding range shape in the static type. Invalid states are unrepresentable by construction; pattern matching is exhaustive with compiler-enforced coverage. Discrete types (int, long, DateOnly) carry step-size awareness for correct adjacency semantics.

Query operations (extension methods on IRange<T>): Contains, IsContainedBy, Overlaps, IsAdjacentTo, IsStrictlyLeftOf, IsStrictlyRightOf, DoesNotExtendRightOf, DoesNotExtendLeftOf.

Set operations (on types implementing IRangeFactory<TRange, T>): Intersect, Union, Except — all shape combinations handled, returning the correctly typed result.

RangeSet<TRange, T> — immutable, always-normalized multirange (counterpart to PostgreSQL 14+ multiranges). Enforces disjoint, sorted, non-adjacent invariant on construction. Supports Contains, Overlaps, Union, Intersect, Except, Complement, operator aliases (|, &, -), structural equality, and IReadOnlyList<TRange>.

No ORM or database driver dependency. MIT license.