pub enum FilterOp {
Show 21 variants
Eq,
EqOrMissing,
EqOrMissingIndexed,
JsonTypeMissing,
JsonTypeMissingOrNullIndexed,
EqOrLegacyIndexed,
TextEqOrNonText,
TextInOrNonText(Vec<SqlValue>),
Ne,
Lt,
Lte,
Gt,
Gte,
JsonTypeEq,
JsonTypeNeMissing,
In(Vec<SqlValue>),
NotInOrMissing(Vec<SqlValue>),
TextStartsWithIndexed,
Rfc3339Valid,
Rfc3339Gte,
Rfc3339Lte,
}Expand description
Comparison operator for a PropertyFilter on a JSON path.
Variants§
Eq
EqOrMissing
Matches rows where the JSON field equals the value OR the field is absent/NULL.
Used for properties that may be missing in legacy rows (e.g. $.read).
EqOrMissingIndexed
Matches the supplied value using the indexable
ifnull(json_extract(...), '') expression. The value may be any
SqlValue accepted by the SQL adapter; in particular, Text("")
matches both missing values and present-but-empty values.
JsonTypeMissing
Matches rows where the JSON field is absent or SQL-NULL.
JsonTypeMissingOrNullIndexed
Matches rows where the JSON field is absent or explicitly JSON null,
while constraining its index key to the empty recipient key. This is
the index-friendly legacy-recipient partition used with
FilterOp::EqOrMissingIndexed.
EqOrLegacyIndexed
Combines the exact-value and legacy-recipient partitions
(EqOrMissingIndexed + JsonTypeMissingOrNullIndexed) into one
predicate over the same indexable ifnull(json_extract(...), '')
expression, so a single index seek serves both partitions instead of
two separate bounded queries. Matches rows where the field equals the
value, OR the field is absent/JSON-null. A present-but-empty JSON
string value does NOT match through the legacy branch — the same
json_type guard JsonTypeMissingOrNullIndexed uses excludes it —
so this reproduces EqOrMissing exactly, given a non-empty compared
value.
TextEqOrNonText
Matches rows where a JSON text field equals the value, while treating
every missing or non-text value as that same value. The SQL adapter
emits CASE WHEN json_type(...) = 'text' THEN json_extract(...) ELSE value END = value, mirroring callers whose read model assigns one
textual default to absent, JSON-null, and malformed legacy values.
TextInOrNonText(Vec<SqlValue>)
Matches a JSON text field against the supplied set, or any missing or
non-text value. The non-text branch still matches when the set is empty.
PropertyFilter.value is unused; the set lives in this variant.
Ne
Lt
Lte
Gt
Gte
JsonTypeEq
Matches rows where json_type(properties, path) = value.
Value must be a SQLite json_type string literal: ‘true’, ‘false’, ‘integer’,
‘real’, ‘text’, ‘array’, ‘object’, or ‘null’.
JsonTypeNeMissing
Matches rows where the json_type is absent (NULL) OR differs from value.
Equivalent to json_type IS NULL OR json_type != value.
Value must be a SQLite json_type string literal: ‘true’, ‘false’,
‘integer’, ‘real’, ‘text’, ‘array’, ‘object’, or ‘null’. Used for
unread filter: matches any $.read that is NOT the JSON boolean true.
In(Vec<SqlValue>)
Matches rows where json_extract(properties, path) equals any value in
the set. A row with a missing/NULL property does not match — use
TextInOrNonText when a textual read model includes missing/non-text
legacy values. PropertyFilter.value is unused for this op; the set
lives in the variant itself.
NotInOrMissing(Vec<SqlValue>)
Matches rows where the property is missing/NULL OR its value is not in
the set. Used to exclude a closed set while treating an unset property
as included (e.g. comm inbox excludes outbound). PropertyFilter.value is
unused for this op; the set lives in the variant itself.
TextStartsWithIndexed
Matches rows whose JSON text field starts with the supplied prefix.
Rendered as an index-seekable half-open range over the plain
json_extract expression (expr >= prefix AND expr < next(prefix),
where next increments the prefix’s last code point), so an index
keyed on that expression serves the seek instead of a scan. SQLite
sorts non-text values outside the text range, so a missing, null or
numeric field never matches. PropertyFilter.value is the prefix and
must be SqlValue::Text; an empty prefix matches every text value.
Rfc3339Valid
Keep only RFC 3339 text values that parse as UTC instants.
Rfc3339Gte
Compare parsed UTC instants, including subsecond precision and offsets.
The value is a Timestamp or RFC 3339 Text.