RunicQuery class

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public sealed class RunicQuery : IEquatable<RunicQuery>

Inherits or implements IEquatable.

The sort and filter of a RunicQueryCollection: portable between the page and .NET, and mapped to LINQ by RunicQueryFields.

Remarks

RunicQuery.Sort orders the rows by its keys in turn; RunicQuery.Filters all apply (a logical AND). Field names are the names the page uses, normally the rows' wire names (label for a Label property). A row source decides which fields it accepts and rejects the others with ArgumentException.

A query is immutable. Two queries are equal when their canonical JSON (RunicQuery.ToString) is equal. The wire form is in specs/application/README.md, "Query collections".

Constructors

RunicQuery

public RunicQuery(IEnumerable<RunicSortKey>? sort = null, IEnumerable<RunicFilter>? filters = null)

Creates a query.

Parameters

sort

The sort keys, in order of precedence.

filters

The filters, which all apply.

Exceptions

ArgumentException

A field name is empty or too long, or there are too many keys or filters.

Fields

MaximumFieldLength

public const int MaximumFieldLength = 128

The longest field name, in UTF-16 code units.

MaximumFilters

public const int MaximumFilters = 32

The most filters a query has.

MaximumSortKeys

public const int MaximumSortKeys = 8

The most sort keys a query has.

Properties

Empty

public static RunicQuery Empty { get; }

A query without sort keys and filters: the source's own order.

Filters

public IReadOnlyList<RunicFilter> Filters { get; }

The filters, which all apply.

Sort

public IReadOnlyList<RunicSortKey> Sort { get; }

The sort keys, in order of precedence.

Methods

Equals

public bool Equals(RunicQuery? other)

Inherits documentation from IEquatable.Equals.

Equals

public override bool Equals(object? obj)

Inherits documentation from Object.Equals.

GetHashCode

public override int GetHashCode()

Inherits documentation from Object.GetHashCode.

ToString

public override string ToString()

The query's canonical wire JSON.

WithFilters

public RunicQuery WithFilters(params IEnumerable<RunicFilter> filters)

Returns a query with this query's sort keys and these filters.

Parameters

filters

The filters, which all apply.

WithSort

public RunicQuery WithSort(params IEnumerable<RunicSortKey> sort)

Returns a query with these sort keys and this query's filters.

Parameters

sort

The sort keys, in order of precedence.