Struct aragog::query::Filter[][src]

pub struct Filter { /* fields omitted */ }

Allows to filter a query according to different Comparison. as an AQL string with the to_aql method.

Implementations

impl Filter[src]

pub fn new(comparison: Comparison) -> Self[src]

Instantiates a new query filter from a comparison item

Example

let filter = Filter::new(Comparison::field("age").greater_than(10));

pub fn and(self, comparison: Comparison) -> Self[src]

Appends the filter current condition(s) with a new one with a AND logic.

Example

let mut filter = Filter::new(Comparison::field("age").greater_than(10));
filter = filter.and(Comparison::field("username").in_str_array(&["felix", "felixm"]));

pub fn or(self, comparison: Comparison) -> Self[src]

Appends the filter current condition(s) with a new one with a OR logic.

Example

let mut filter = Filter::new(Comparison::field("age").greater_than(10));
filter = filter.or(Comparison::field("username").in_str_array(&["felix", "felixm"]));

pub fn to_aql(&self, collection_id: &str) -> String[src]

Renders the AQL string corresponding to the current Filter. The query will go out of scope.

Example

let mut filter = Filter::new(Comparison::field("age").greater_than(10)).
    or(Comparison::field("username").in_str_array(&["felix", "felixm"]));
assert_eq!(filter.to_aql("i"), String::from(r#"i.age > 10 || i.username IN ["felix", "felixm"]"#));

Trait Implementations

impl Clone for Filter[src]

impl Debug for Filter[src]

impl From<Comparison> for Filter[src]

Auto Trait Implementations

impl RefUnwindSafe for Filter

impl Send for Filter

impl Sync for Filter

impl Unpin for Filter

impl UnwindSafe for Filter

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.