Enum cudb::query::Constraint[][src]

pub enum Constraint {
    MatchesDocument(ConstraintDocument),
    Equals(Value),
    LessThan(Value),
    GreaterThan(Value),
    In(Vec<Value>),
    Or(Box<Constraint>, Box<Constraint>),
    And(Box<Constraint>, Box<Constraint>),
}
Expand description

A single query constraint on a field.

Note that Constraints applied to an array value will map the constraint over the array.

Variants

MatchesDocument(ConstraintDocument)

Constraints on subdocuments (hashtables).

Tuple Fields of MatchesDocument

0: ConstraintDocument
Equals(Value)

Equality constraint on a value.

Tuple Fields of Equals

0: Value
LessThan(Value)

Less-than constraint on a value.

Tuple Fields of LessThan

0: Value
GreaterThan(Value)

Greater-than constraint on a value.

Tuple Fields of GreaterThan

0: Value
In(Vec<Value>)

Constraint if value is in specified list of values.

Tuple Fields of In

0: Vec<Value>
Or(Box<Constraint>, Box<Constraint>)

Disjunction of constraints on a single field.

Tuple Fields of Or

0: Box<Constraint>1: Box<Constraint>
And(Box<Constraint>, Box<Constraint>)

Conjunction of constraints on a single field.

Tuple Fields of And

0: Box<Constraint>1: Box<Constraint>

Implementations

Determine the type of a constraint. Return None if the Constraint is invalid due to mismatched subconstraints.

Whether a Value matches a constraint.

Generate the value range(s) for this constraint.

Note: for the time being, this generates inclusive ranges only, because we cannot mix inclusive and exclusive ranges in a multi-field index. Note that since we also cannot mix unbounded ranges, one-sided ranges (such as inequalities) use a predefined min/max value. For unbounded numbers, this limits the range of valid numbers that can be returned with a range. This can be considered a “feature” of our implementation due to the limitations of using the builtin BTreeMap implementation. An alternative implementation is to create a special value type that represents the extrema of a type (which would probably be a cleaner and more robust solution if only I had thought of it earlier).

Note: disjunction (OR) operator assumes ranges are non-overlapping.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

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

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.