Class TimeQuery
Discriminated union over the supported temporal input shapes.
public abstract record TimeQuery : IEquatable<TimeQuery>
- Inheritance
-
TimeQuery
- Implements
- Derived
- Inherited Members
Remarks
Tools that accept a time parameter take a TimeQuery
rather than a bare DateTimeOffset? so the same wire shape
handles single-instant, range, and stepped-series questions.
TimeQuery.Instant selects a single point in time (the existing
nearest-step semantics in coverage samplers). TimeQuery.Range
expresses "anywhere in [from, to]" — used both as a coverage-series
window and as a feature-validity filter. TimeQuery.Series
expresses "every step from from through to",
useful for "every 30 min for 6 hours" agent queries.
Construct instances via the static factory methods; the underlying records validate their bounds and throw ArgumentException on degenerate inputs. Use Parse(string) to construct from the wire format.
Fields
MaxSeriesCount
Hard cap on the number of instants a TimeQuery.Series may enumerate.
public const int MaxSeriesCount = 4096
Field Value
Remarks
Mirrors the page-size cap on query_features — server-side
protection against agents asking for a 1-second cadence over a
week. Tools should surface a structured error when the requested
cadence × window exceeds this.
Methods
At(DateTimeOffset)
Creates a single-instant query. The supplied DateTimeOffset is normalised to UTC.
public static TimeQuery.Instant At(DateTimeOffset value)
Parameters
valueDateTimeOffset
Returns
Between(DateTimeOffset, DateTimeOffset)
Creates a range query. Throws ArgumentException when
to precedes from.
public static TimeQuery.Range Between(DateTimeOffset from, DateTimeOffset to)
Parameters
fromDateTimeOffsettoDateTimeOffset
Returns
Contains(DateTimeOffset)
Returns true when instant falls inside
this query's window. For TimeQuery.Instant requires equality.
public bool Contains(DateTimeOffset instant)
Parameters
instantDateTimeOffset
Returns
Every(DateTimeOffset, DateTimeOffset, TimeSpan)
Creates a stepped-series query. Throws ArgumentException on degenerate ordering or non-positive step.
public static TimeQuery.Series Every(DateTimeOffset from, DateTimeOffset to, TimeSpan step)
Parameters
fromDateTimeOffsettoDateTimeOffsetstepTimeSpan
Returns
GetWindow()
Window covered by this query. For TimeQuery.Instant the
window is a degenerate (zero-length) range at the requested
instant; for TimeQuery.Series it's the range from
From to To (the actual enumeration may end earlier
when (To - From) % Step != 0).
public (DateTimeOffset From, DateTimeOffset To) GetWindow()
Returns
Overlaps(DateTimeOffset?, DateTimeOffset?)
Returns true when this query's window overlaps the supplied
validity interval. Useful for feature-validity filtering.
public bool Overlaps(DateTimeOffset? validityStart, DateTimeOffset? validityEnd)
Parameters
validityStartDateTimeOffset?Inclusive validity start;
nullmeans "open-ended in the past".validityEndDateTimeOffset?Inclusive validity end;
nullmeans "open-ended in the future".