Rust

[Select]: select queries.

Contents

use utopia_database::validator::query::select::Select;
Rust
pub struct Select

A select query of distinct attribute names, each an attribute of the collection (any, without a schema), an internal attribute, *, or a dotted path whose first segment is one of those.

Rust
use utopia_database::Document;
use utopia_database::query::{Method, Query};
use utopia_database::validator::query::select::Select;
use utopia_database::value::string;

let select = Select::new(&[Document::from_pairs([("key", string("name"))]).unwrap()], true);
assert!(select.check(&Query::new(Method::Select, "", vec![string("name"), string("$id")])));
assert!(!select.check(&Query::new(Method::Select, "", vec![string("name"), string("name")])));
assert_eq!(select.description(), "Duplicate attributes selected");
Also implements Default.