filter
Module[Filter]: filter queries (equal, contains, between, spatial,
vector, logical, ...).
Contents
Structs
FilterA filter query on an attribute of the collection whose values suit the attribute's type: at most `max_values_count` values, strings for strings, integers in range for integers, dates between the allowed dates, ... Logical queries (`and`, `or`, `elemMatch`) must nest filters.FilterOptionsUndocumented.use utopia_database::validator::query::filter::Filter;Rust
pub struct FilterA filter query on an attribute of the collection whose values suit the
attribute's type: at most max_values_count values, strings for
strings, integers in range for integers, dates between the allowed
dates, ... Logical queries (and, or, elemMatch) must nest filters.
Rust
use utopia_database::Document;
use utopia_database::query::{Method, Query};
use utopia_database::validator::query::filter::Filter;
use utopia_database::value::{Value, string};
let attributes = [Document::from_pairs([
("key", string("age")),
("type", string("integer")),
("array", Value::Bool(false)),
])
.unwrap()];
let filter = Filter::new(&attributes, "integer");
assert!(filter.check(&Query::new(Method::GreaterThan, "age", vec![Value::Int(18)])));
assert!(!filter.check(&Query::new(Method::GreaterThan, "age", vec![string("18")])));
assert_eq!(filter.description(), "Query value is invalid for attribute \"age\"");use utopia_database::validator::query::filter::FilterOptions;Rust
pub struct FilterOptionsUndocumented.
Also implements
Default.