Class FilterParser
- Namespace
- Excalibur.EventSourcing
- Assembly
- Excalibur.EventSourcing.Abstractions.dll
Utility for parsing filter keys into property names and operators.
public static class FilterParser
- Inheritance
-
FilterParser
- Inherited Members
Remarks
Filter keys use a colon-separated format where the property name comes first, followed by an optional operator suffix. For example:
"Status"- Equals comparison (no suffix)"Amount:gt"- Greater than comparison"Tags:in"- In collection comparison
Providers use this utility to consistently parse filter dictionaries before translating them to native query syntax.
Methods
Parse(string)
Parses a filter key into its property name and operator components.
public static ParsedFilter Parse(string key)
Parameters
keystringThe filter key to parse (e.g., "Amount:gt").
Returns
- ParsedFilter
A ParsedFilter containing the property name and operator.
Remarks
Supported operator suffixes:
| Suffix | Operator |
|---|---|
| (none) | Equals |
| eq | Equals, stated explicitly |
| neq | NotEquals |
| gt | GreaterThan |
| gte | GreaterThanOrEqual |
| lt | LessThan |
| lte | LessThanOrEqual |
| in | In |
| contains | Contains |
An unrecognised suffix is REFUSED, not read as equality. It used to default to
Equals, which meant a mistyped suffix -- "Amount:gtt" for
"Amount:gt" -- silently became an equality filter on Amount: the query ran, returned
a wrong set, and reported nothing. The suffix is the one part of a filter key a reader cannot
check by eye, because a typo in it still reads as a sensible key.
ProjectionFilterBuilder composes these keys from typed methods and cannot produce an invalid one; prefer it where the filter is known at compile time.
Exceptions
- ArgumentNullException
Thrown when
keyis null.- ArgumentException
Thrown when the key names no property, or carries a suffix that is not one of those below.