reckon_db_filters (reckon_db v1.6.0)
View SourceKhepri event filters for reckon-db
Provides filter builders for Khepri event subscriptions. These filters are used to watch for new events matching specific criteria.
Summary
Functions
Create a filter matching events with a specific pattern in their metadata
Create a filter matching events with a specific pattern in their payload
Create a filter for events of a specific type
Create a filter for all events in a specific stream
Create a filter matching events with specific tags
Functions
-spec by_event_pattern(map()) -> khepri_evf:tree().
Create a filter matching events with a specific pattern in their metadata
The pattern is a map that must be a subset of the event record.
-spec by_event_payload(map()) -> khepri_evf:tree().
Create a filter matching events with a specific pattern in their payload
The pattern is checked against the data field of the event.
-spec by_event_type(binary()) -> khepri_evf:tree().
Create a filter for events of a specific type
Uses #event{} record pattern matching since events are stored as records.
-spec by_stream(binary()) -> khepri_evf:tree() | {error, invalid_stream}.
Create a filter for all events in a specific stream
Special case: the binary <<"$all">> matches events in all streams.
-spec by_tags([binary()]) -> khepri_evf:tree().
Create a filter matching events with specific tags
Note: Khepri's pattern matching doesn't natively support list membership, so this creates a broad filter that matches all events with tags. The actual tag filtering must be done by the subscription consumer. For efficient tag-based queries, use reckon_db_streams:read_by_tags/4.