pub struct EventQuery {
pub topic: Option<String>,
pub project_id: Option<String>,
pub scope_id: Option<String>,
pub from_commit_seq_exclusive: Option<u64>,
pub to_commit_seq_exclusive: Option<u64>,
pub from_ts_micros: Option<u64>,
pub to_ts_micros: Option<u64>,
pub field_filters: Vec<EventFieldFilter>,
pub order: EventOrder,
pub limit: usize,
}Expand description
Ergonomic query over the canonical event log (the event_outbox system
table). Supports filtering by event type (topic), project/scope,
commit-sequence range (cursor pagination), time range, and arbitrary
payload fields (recipient, instance_id, block, …), in either direction.
Construct with EventQuery::new and the builder methods, then pass to
AedbInstance::query_events. Pagination is commit-atomic: a page never
splits the events emitted by a single commit, and the returned
EventStreamPage::next_commit_seq is the cursor for the next page
(feed it back as from_commit_seq_exclusive for ascending queries, or
to_commit_seq_exclusive for descending queries).
Fields§
§topic: Option<String>Event type filter (matches the emit topic). None matches all.
project_id: Option<String>Restrict to events emitted under this project. None matches all.
scope_id: Option<String>Restrict to events emitted under this scope. None matches all.
from_commit_seq_exclusive: Option<u64>Exclusive lower bound on commit sequence (ascending cursor).
to_commit_seq_exclusive: Option<u64>Exclusive upper bound on commit sequence (descending cursor).
from_ts_micros: Option<u64>Inclusive lower bound on event timestamp (micros since epoch).
to_ts_micros: Option<u64>Inclusive upper bound on event timestamp (micros since epoch).
field_filters: Vec<EventFieldFilter>Payload field equality filters (ANDed together).
order: EventOrderScan direction.
limit: usizeMaximum number of events to return in this page.
Implementations§
Source§impl EventQuery
impl EventQuery
Sourcepub fn new() -> Self
pub fn new() -> Self
Start an empty query (ascending, no filters). Set limit before use;
a limit of 0 yields an empty page.
Sourcepub fn namespace(
self,
project_id: impl Into<String>,
scope_id: impl Into<String>,
) -> Self
pub fn namespace( self, project_id: impl Into<String>, scope_id: impl Into<String>, ) -> Self
Restrict to a single project / scope namespace.
Sourcepub fn after_commit_seq(self, seq: u64) -> Self
pub fn after_commit_seq(self, seq: u64) -> Self
Resume an ascending scan after this commit sequence (exclusive).
Sourcepub fn before_commit_seq(self, seq: u64) -> Self
pub fn before_commit_seq(self, seq: u64) -> Self
Resume a descending scan before this commit sequence (exclusive).
Sourcepub fn time_range(
self,
from_micros: Option<u64>,
to_micros: Option<u64>,
) -> Self
pub fn time_range( self, from_micros: Option<u64>, to_micros: Option<u64>, ) -> Self
Inclusive timestamp window (micros since epoch).
Sourcepub fn where_field(
self,
field: impl Into<String>,
equals: impl Into<String>,
) -> Self
pub fn where_field( self, field: impl Into<String>, equals: impl Into<String>, ) -> Self
Add a payload-field equality filter (e.g. recipient, instance_id, block).
Sourcepub fn descending(self) -> Self
pub fn descending(self) -> Self
Newest-first ordering (for “latest N by type”).
Trait Implementations§
Source§impl Clone for EventQuery
impl Clone for EventQuery
Source§fn clone(&self) -> EventQuery
fn clone(&self) -> EventQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EventQuery
impl Debug for EventQuery
Source§impl Default for EventQuery
impl Default for EventQuery
Source§fn default() -> EventQuery
fn default() -> EventQuery
impl Eq for EventQuery
Source§impl PartialEq for EventQuery
impl PartialEq for EventQuery
Source§fn eq(&self, other: &EventQuery) -> bool
fn eq(&self, other: &EventQuery) -> bool
self and other values to be equal, and is used by ==.