Operators Reference
FlexQuery.NET provides a comprehensive set of operators for filtering data. These operators behave consistently across all query formats.
Comparison Operators
Standard numeric and date comparisons.
| Operator | Description | DSL/JSON Example | JQL Example |
|---|---|---|---|
eq | Equal | age:eq:25 | age = 25 |
neq | Not equal | status:neq:Closed | status != "Closed" |
gt | Greater than | price:gt:100 | price > 100 |
gte | Greater than or equal | price:gte:100 | price >= 100 |
lt | Less than | rating:lt:5 | rating < 5 |
lte | Less than or equal | rating:lte:5 | rating <= 5 |
String Operators
Powerful substring and pattern matching for text fields.
| Operator | Description | DSL/JSON Example | JQL Example |
|---|---|---|---|
contains | Substring search | name:contains:john | name CONTAINS "john" |
startswith | Prefix search | sku:startswith:ABC | sku STARTSWITH "ABC" |
endswith | Suffix search | email:endswith:.com | email ENDSWITH ".com" |
like | SQL LIKE pattern | name:like:%smith% | name LIKE "%smith%" |
Null Check Operators
Explicit checks for presence or absence of data.
| Operator | Description | DSL/JSON Example | JQL Example |
|---|---|---|---|
isnull | Is null | deletedAt:isnull | deletedAt IS NULL |
isnotnull | Is not null | updatedAt:isnotnull | updatedAt IS NOT NULL |
Collection & Range Operators
Filtering based on sets or ranges of values.
| Operator | Description | DSL/JSON Example | JQL Example |
|---|---|---|---|
in | Value in list | status:in:Active,Pending | status IN ("Active", "Pending") |
notin | Value not in list | category:notin:Old | category NOT IN ("Old") |
between | Inclusive range | price:between:10,50 | price BETWEEN 10 AND 50 |
Advanced (Collection) Operators
Scoped filtering for nested navigation properties.
| Operator | Description | Example |
|---|---|---|
any | At least one match | orders:any:total:gt:100 |
all | All elements match | items:all:status:eq:Shipped |
count | Count comparison | orders:count:gt:5 |
Logic & Negation
FlexQuery supports complex logical combinations and negation.
- Negation (
!,not):- DSL:
!name:eq:johnornot(name:eq:john) - JQL:
NOT name = "john"
- DSL:
- Logical AND/OR:
- DSL:
&(AND),|(OR) - JQL:
AND,OR - JSON:
"logic": "and","logic": "or"
- DSL:
Operator Normalization
FlexQuery is syntax-tolerant and automatically normalizes common variants to their canonical codes during parsing.
| Your Input | Normalized To |
|---|---|
=, ==, equals | eq |
!=, notequal | neq |
>, greaterthan | gt |
>=, ge | gte |
<, lessthan | lt |
<=, le | lte |
Usage Examples
Here are some common ways to use these operators in a standard query string:
- Age over 25:
?filter=age:gt:25 - Name search:
?filter=name:contains:john - Multiple statuses:
?filter=status:in:Active,Pending - Price range:
?filter=price:between:100,500
Strongly-Typed Usage
When building queries in C#, use the FilterOperators constants to ensure consistency.
csharp
using FlexQuery.NET.Constants;
var condition = new FilterCondition
{
Field = "Status",
Operator = FilterOperators.Equal,
Value = "Active"
};Formatting Tips
- Dates: Use ISO-8601 strings (e.g.,
2026-05-01T10:00:00Z). - Enums: Use the string representation or the integer value.
- Nulls: Use the
isnullornotnulloperators instead of comparing to a "null" string.
