[][src]Struct ejdb::query::FieldConstraint

pub struct FieldConstraint(_, _);

A transient builder for adding field-based query constraints.

Instances of this structure are returned by Query::field() and FieldConstraint::field() methods.

Methods

impl FieldConstraint[src]

pub fn field<S: Into<String>>(self, name: S) -> FieldConstraint[src]

Returns a constraint builder for a deeper field.

pub fn eq<V: Into<Bson>>(self, value: V) -> Query[src]

Adds an equality constraint for this field and value.

pub fn begin<S: Into<String>>(self, value: S) -> Query[src]

Adds a $begin constraint for this field.

The value of this field must start with value. The field type should be string.

pub fn between<N1: BsonNumber, N2: BsonNumber>(
    self,
    left: N1,
    right: N2
) -> Query
[src]

Adds a $between constraint for this field.

The value of this field must be greater than or equal to left and less than or equal to right. The field type should be numeric.

pub fn gt<N: BsonNumber>(self, value: N) -> Query[src]

Adds a $gt constraint for this field.

The value of this field must be strictly greater than value. The field type should be numeric.

pub fn gte<N: BsonNumber>(self, value: N) -> Query[src]

Adds a $gte constraint for this field.

The value of this field must be greater than or equal to value. The field type should be numeric.

pub fn lt<N: BsonNumber>(self, value: N) -> Query[src]

Adds an $lt constraint for this field.

The value of this field must be strictly less than value. The field type should be numeric.

pub fn lte<N: BsonNumber>(self, value: N) -> Query[src]

Adds an $lte constraint for this field.

The value of this field must be less than or equal to value. The field type should be numeric.

pub fn exists(self, exists: bool) -> Query[src]

Adds an $exists constraint for this field.

The field must exist if exists is true, the opposite otherwise.

pub fn elem_match<Q: Into<Document>>(self, query: Q) -> Query[src]

Adds an $elemMatch constraint for this field.

Any element of the array contained in this field must match query. The query argument is a regular EJDB query; you can pass another Query object to it.

pub fn contained_in<I>(self, values: I) -> Query where
    I: IntoIterator,
    I::Item: Into<Bson>, 
[src]

Adds an $in constraint for this field.

The value of this field must be equal to one of the values yielded by values.

pub fn not_contained_in<I>(self, values: I) -> Query where
    I: IntoIterator,
    I::Item: Into<Bson>, 
[src]

Adds an $nin constraint for this field.

The value of this field must not be equal to any of the values yielded by values.

pub fn case_insensitive(self) -> FieldConstraint[src]

Adds a $icase constraint for this field.

Makes all further constraints for this field case insensitive with regard to string values.

pub fn not(self) -> FieldConstraint[src]

Adds a $not constraint for this field.

Inverts the further query, making only those elements which do NOT satisfy the following constraints to match.

pub fn str_and<I>(self, values: I) -> Query where
    I: IntoIterator,
    I::Item: Into<String>, 
[src]

Adds an $strand constraint for this field.

  1. If this field holds an array of strings, $strand returns those records whose array contains all elements from values.
  2. If this field holds a string, it is first split into an array by space ' ' or comma ',' characters, and the resulting array is queried like in 1.

pub fn str_or<I>(self, values: I) -> Query where
    I: IntoIterator,
    I::Item: Into<String>, 
[src]

Adds an $stror constraint for this field.

  1. If this field holds an array of strings, $stror returns those records whose array contains at least one element from values.
  2. If this field holds a string, it is first split into an array by space ' ' or comma ',' characters, and the resulting array is queried like in 1.

Auto Trait Implementations

impl Send for FieldConstraint

impl Sync for FieldConstraint

Blanket Implementations

impl<T> From for T[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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