Struct RangeFilter<T>
- Namespace
- MassiveDotNet
- Assembly
- MassiveDotNet.dll
A filter over an ordered field: an exact value, a lower bound, an upper bound, or both.
public readonly struct RangeFilter<T>
Type Parameters
TThe field's element type.
- Inherited Members
Remarks
Build one with the factories on RangeFilter, or pass a plain
T where a filter is expected: it converts implicitly to an equality
filter, so ticker: "AAPL" keeps compiling on an endpoint that also accepts a range.
A lower bound accepts an upper bound afterwards and vice versa, so a half-open window is
RangeFilter.Gte(start).Lt(end). An unset filter (default) renders
nothing, exactly like a null parameter.
Methods
Gt(T)
Adds an exclusive lower bound: field.gt=value.
public RangeFilter<T> Gt(T value)
Parameters
valueTThe value results must exceed.
Returns
- RangeFilter<T>
The filter with the bound added.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
The filter is an equality, or already has a lower bound.
Gte(T)
Adds an inclusive lower bound: field.gte=value.
public RangeFilter<T> Gte(T value)
Parameters
valueTThe value results must reach.
Returns
- RangeFilter<T>
The filter with the bound added.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
The filter is an equality, or already has a lower bound.
Lt(T)
Adds an exclusive upper bound: field.lt=value.
public RangeFilter<T> Lt(T value)
Parameters
valueTThe value results must stay below.
Returns
- RangeFilter<T>
The filter with the bound added.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
The filter is an equality, or already has an upper bound.
Lte(T)
Adds an inclusive upper bound: field.lte=value.
public RangeFilter<T> Lte(T value)
Parameters
valueTThe value results must not exceed.
Returns
- RangeFilter<T>
The filter with the bound added.
Exceptions
- ArgumentNullException
valueis null.- InvalidOperationException
The filter is an equality, or already has an upper bound.
Operators
implicit operator RangeFilter<T>(T?)
Converts a value to an equality filter: field=value.
public static implicit operator RangeFilter<T>(T? value)
Parameters
valueTThe exact value to match, or null to produce an unset filter that renders nothing.
Returns
- RangeFilter<T>
Remarks
The parameter is annotated T? rather than T. For this unconstrained type
parameter that is annotation-only: a reference-type T may be null,
while a value-type T is unaffected -- there is no
Nullable<T> wrapping, so RangeFilter.Gt(1) and the lifted conversion
from a long? both behave exactly as before. The annotation states what this
operator actually does: a null reference, such as a string? ticker = null variable
passed where a filter is expected, converts to an unset filter instead of throwing
ArgumentNullException naming a parameter (value) the caller never
wrote, matching every other optional parameter in this SDK.