pub struct QueryBuilder { /* private fields */ }Expand description
Query builder for constructing flexible event queries.
Supports building XPath queries with convenience methods while allowing raw XPath for advanced scenarios.
Implementations§
Source§impl QueryBuilder
impl QueryBuilder
Sourcepub fn xpath(self, xpath: impl Into<Cow<'static, str>>) -> Self
pub fn xpath(self, xpath: impl Into<Cow<'static, str>>) -> Self
Set a raw XPath query expression.
When set, this takes precedence over other builder fields.
Example: "Event/System[EventID=4688]"
Sourcepub fn level(self, level: EventLevel) -> Self
pub fn level(self, level: EventLevel) -> Self
Filter by event level (1=Critical to 5=Verbose).
Sourcepub fn provider(self, name: impl Into<Cow<'static, str>>) -> Self
pub fn provider(self, name: impl Into<Cow<'static, str>>) -> Self
Filter by provider/source name.
Sourcepub fn reverse(self) -> Self
pub fn reverse(self) -> Self
Query in reverse order (newest to oldest).
Note: Not supported on Debug/Analytic channels or .evt files.
Sourcepub fn max_results(self, count: usize) -> Self
pub fn max_results(self, count: usize) -> Self
Limit maximum number of results returned.
Sourcepub fn with_event_data(self) -> Self
pub fn with_event_data(self) -> Self
Parse EventData fields into the data HashMap.
When enabled, extracts fields from event XML. Common field names are cached as static strings for performance.
Sourcepub fn with_message(self) -> Self
pub fn with_message(self) -> Self
Parse event message using publisher metadata.
When enabled, formats the event message using the provider’s message template. Returns None if publisher metadata is unavailable.
Sourcepub fn should_parse_event_data(&self) -> bool
pub fn should_parse_event_data(&self) -> bool
Check if EventData parsing is enabled.
Sourcepub fn should_parse_message(&self) -> bool
pub fn should_parse_message(&self) -> bool
Check if message parsing is enabled.
Sourcepub fn build_xpath(&self) -> String
pub fn build_xpath(&self) -> String
Build the final XPath query string.
Returns the XPath expression that will be passed to Windows Event Log API. If raw XPath was set, returns that. Otherwise, builds XPath from builder fields.
Sourcepub fn is_reverse(&self) -> bool
pub fn is_reverse(&self) -> bool
Get whether query should be reversed.
Sourcepub fn max_results_limit(&self) -> Option<usize>
pub fn max_results_limit(&self) -> Option<usize>
Get maximum results limit if set.
Trait Implementations§
Source§impl Clone for QueryBuilder
impl Clone for QueryBuilder
Source§fn clone(&self) -> QueryBuilder
fn clone(&self) -> QueryBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more