Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Releases: CaffeinatedCoder/CodoMetis.ValueRanges

v3.1.0

17 Jun 19:36
@CaffeinatedCoder CaffeinatedCoder

Choose a tag to compare

What's new in v3.1

PerformanceRangeSet<TRange, T> now exploits its sorted, disjoint, non-adjacent invariant for sub-linear queries and merge-join set operations. No public API or results changed — only the time complexity:

Operation Before After
Contains(T), Contains(IRange<T>), Overlaps(IRange<T>) O(n) linear scan O(log n) binary search on lower bounds
Union(RangeSet, RangeSet) re-sort of concatenation O(n + m) merge of two pre-sorted streams
Intersect(RangeSet, RangeSet) O(n · m) nested loop O(n + m) two-pointer merge-join
Except(RangeSet, RangeSet) per-element re-normalization O(n + m) two-pointer walk
Except from Infinite O(|other|2) O(|other|) single-pass complement walk
From single-element input list + sort + merge zero-allocation fast path

New APIRangeSet<TRange, T>.LowerBoundComparer exposes the set's internal lower-bound ordering as a public IComparer<TRange> singleton, for sorting arbitrary List<TRange>s the same way the set does. Also available as RangeLowerBoundComparer<TRange, T>.Instance. See RangeSet — Sorting ranges externally.

Bug fix — Quoted range bounds now unescape PostgreSQL \"" and \\\ on parse, so element types whose stringification can contain quotes or backslashes round-trip correctly. See Parsing — Quoted bounds.

Assets 2
Loading

v3.0.0

11 Jun 18:34
@CaffeinatedCoder CaffeinatedCoder

Choose a tag to compare

New Features

Finally: the companion package CodoMetis.ValueRanges.EFCore.PostgreSQL is here! It enables seamless mapping of range types to PostgreSQL range and multirange columns (leveraging NpgsqlRange<T> under the hood). Implemented LINQ-to-SQL query translation for range operations, including Contains, Overlaps, Intersect, Except and Union. Added support for RangeSet translation and query expression rewriting to properly translate from C# operators (&, |, -) to their Postgres-equivalents.

Breaking Changes

State-check methods now require parentheses
IsEmpty, IsFinite, IsInfinity, IsUnboundedStart, and IsUnboundedEnd were extension properties in v2.x. In v3.0.0 they are extension methods — add parentheses at every call site:

// v2.x
if (range.IsEmpty) { ... }
// v3.0.0
if (range.IsEmpty()) { ... }

The change is mechanical and the compiler will flag every affected site. The motivation is EF Core compatibility: extension properties cannot appear in LINQ expression trees, preventing SQL translation. As extension methods they are fully translated by the EF Core companion package.

Full Changelog: v2.0.0...v3.0.0

Loading

v2.0.0

11 Jun 13:30
@CaffeinatedCoder CaffeinatedCoder

Choose a tag to compare

New Features

  • Implemented Parse and ToString methods across range types for interoperability with PostgreSQL range literal syntax.
  • Introduced JSON converters for seamless serialization.

Full Changelog: v1.0.0...v2.0.0

Loading

v1.0.0

10 Jun 17:58
@CaffeinatedCoder CaffeinatedCoder

Choose a tag to compare

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.

Loading

AltStyle によって変換されたページ (->オリジナル) /