Struct aragog::query::Comparison [−][src]
Struct representing one AQL comparison in a Query
.
Implementations
impl Comparison
[src]
pub fn field(field_name: &str) -> ComparisonBuilder
[src]
Instantiates a new builder for a Comparison
with the specified field_name
.
The field will be used as the left value of the comparison.
Example
Query::new("Users").filter(Filter::new(Comparison::field("name").equals_str("felix"))); // or Query::new("Users").filter(Comparison::field("name").equals_str("felix").into());
pub fn all(array_field_name: &str) -> ComparisonBuilder
[src]
Instantiates a new builder for a Comparison
with the specified array_field_name
.
The field should be an array, as all items in the array will have to match the comparison
to succeed.
Example
In this example the query will render all documents where every price is above 10.
Query::new("Products").filter(Filter::new(Comparison::all("prices").greater_or_equal(10))); // or Query::new("Users").filter(Comparison::all("prices").greater_or_equal(10).into());
pub fn none(array_field_name: &str) -> ComparisonBuilder
[src]
Instantiates a new builder for a Comparison
with the specified array_field_name
.
The field should be an array, none of the items in the array can match the comparison to succeed.
Example
In this example the query will render all documents where every price is not above 10.
Query::new("Products").filter(Filter::new(Comparison::none("prices").greater_or_equal(10))); // or Query::new("Users").filter(Comparison::none("prices").greater_or_equal(10).into());
pub fn any(array_field_name: &str) -> ComparisonBuilder
[src]
Instantiates a new builder for a Comparison
with the specified array_field_name
.
The field should be an array, at least one of the items in the array must match the
comparison to succeed.
Example
In this example the query will render all documents where at least one price is above 10.
Query::new("Products").filter(Filter::new(Comparison::any("prices").greater_or_equal(10))); // or Query::new("Users").filter(Comparison::any("prices").greater_or_equal(10).into());
pub fn statement(statement: &str) -> ComparisonBuilder
[src]
Instantiates a new builder for a Comparison
with the specified statement
.
The field will be used as the left value of the comparison.
Example
Query::new("Products").filter(Filter::new(Comparison::statement("10 * 3").greater_or_equal(10))); // or Query::new("Products").filter(Comparison::statement("10 * 3").greater_or_equal(10).into());
pub fn and(self, comparison: Comparison) -> Filter
[src]
Appends the filter current condition(s) with a new one with a AND
logic.
self
will be treated as a Filter
.
/// Both are equivalent let a = Filter::new(Comparison::field("age").greater_than(10)).and(Comparison::field("age").lesser_or_equal(18)); let b = Comparison::field("age").greater_than(10).and(Comparison::field("age").lesser_or_equal(18)); assert_eq!(a.to_aql("i"), b.to_aql("i"));
pub fn or(self, comparison: Comparison) -> Filter
[src]
Appends the filter current condition(s) with a new one with a OR
logic.
self
will be treated as a Filter
.
/// Both are equivalent let a = Filter::new(Comparison::field("age").greater_than(10)).or(Comparison::field("age").lesser_or_equal(18)); let b = Comparison::field("age").greater_than(10).or(Comparison::field("age").lesser_or_equal(18)); assert_eq!(a.to_aql("i"), b.to_aql("i"));
pub fn to_aql(&self, collection_id: &str) -> String
[src]
Renders self
in a valid AQL format.
collection_id
is simply the collection identifier, it can be any string.
Note
You should not use this method except for debug purpose, use Query
::to_aql
instead
Example
use aragog::query::Comparison; let comparison = Comparison::field("age").greater_than(18); assert_eq!(comparison.to_aql("i").as_str(), "i.age > 18")
Trait Implementations
impl Clone for Comparison
[src]
fn clone(&self) -> Comparison
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Comparison
[src]
impl From<Comparison> for Filter
[src]
fn from(comparison: Comparison) -> Self
[src]
Auto Trait Implementations
impl RefUnwindSafe for Comparison
impl Send for Comparison
impl Sync for Comparison
impl Unpin for Comparison
impl UnwindSafe for Comparison
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,