Rust

index_dependency

Module

[IndexDependency]: whether an attribute can be deleted or renamed while indexes use it.

Contents

use utopia_database::validator::index_dependency::IndexDependency;
Rust
pub struct IndexDependency

An attribute that no index uses, when the adapter indexes array attributes through casts (cast_index_support) and the attribute is an array; any attribute otherwise.

Rust
use utopia_database::Document;
use utopia_database::validator::index_dependency::IndexDependency;
use utopia_database::value::{Value, list, string};

let index = Document::from_pairs([("attributes", list([string("tags")]))]).unwrap();
let validator = IndexDependency::new(vec![index], true);
let tags = Document::from_pairs([("key", string("tags")), ("array", Value::Bool(true))]).unwrap();
assert!(!validator.check(&tags));