Struct exar::Query [] [src]

pub struct Query {
    pub live_stream: bool,
    pub offset: u64,
    pub limit: Option<u64>,
    pub tag: Option<String>,
    // some fields omitted
}

Exar DB's subscription query.

Examples

extern crate exar;

use exar::*;

let query = Query::new(true, 100, Some(20), Some("tag".to_owned()));
 
// or using the fluent API
let fluent_query = Query::live().offset(100).limit(20).by_tag("tag");

Fields

live_stream: bool

Indicates wether the query targets real-time events.

offset: u64

Indicates the query target offset.

limit: Option<u64>

Indicates the maximum number of events to be returned by the query, if specified.

tag: Option<String>

Indicates the query target event tag, if specified.

Methods

impl Query
[src]

fn new(live_stream: bool, offset: u64, limit: Option<u64>, tag: Option<String>) -> Query

Creates a new Query from the given parameters.

fn current() -> Query

Initializes a Query targeting the current events in the event log.

fn live() -> Query

Initializes a Query targeting the current and real-time events in the event log.

fn offset(self, offset: u64) -> Query

Mutates and returns the query by updating its target offset.

fn limit(self, limit: u64) -> Query

Mutates and returns the query by updating its limit.

fn by_tag(self, tag: &str) -> Query

Mutates and returns the query by updating its target event tag.

fn matches(&self, event: &Event) -> bool

Returns wether a given Event matches the query.

fn is_active(&self) -> bool

Returns wether the query is still active.

fn update(&mut self, event_id: u64)

Updates the internal state of the query given the last matching event id.

fn interval(&self) -> Interval<u64>

Returns the offsets interval the query targets.

Trait Implementations

impl Eq for Query
[src]

impl PartialEq for Query
[src]

fn eq(&self, __arg_0: &Query) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Query) -> bool

This method tests for !=.

impl Debug for Query
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl Clone for Query
[src]

fn clone(&self) -> Query

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more