pub struct VaultSchema {
pub collections: BTreeMap<String, CollectionSchema>,
}Expand description
Top-level schema file structure.
Fields§
§collections: BTreeMap<String, CollectionSchema>Implementations§
Source§impl VaultSchema
impl VaultSchema
Sourcepub fn collections_for_folder<'a>(
&'a self,
folder: &str,
) -> Vec<(&'a String, &'a CollectionSchema)>
pub fn collections_for_folder<'a>( &'a self, folder: &str, ) -> Vec<(&'a String, &'a CollectionSchema)>
Collections whose folder matches folder exactly, or is a path
under it (e.g. when folder = "Notes", also matches collections
declared with folder: Notes/movie). Used by schema show /
schema validate to scope queries to a folder, and by the MCP
schema_show tool’s optional folder filter.
Sourcepub fn collection_for_folder<'a>(
&'a self,
folder: &str,
) -> Option<&'a CollectionSchema>
pub fn collection_for_folder<'a>( &'a self, folder: &str, ) -> Option<&'a CollectionSchema>
The single collection whose folder matches folder exactly.
Used by CreateBuilder to pick the unambiguous schema for a
vaultdb create <folder> invocation. Prefix matches don’t apply
here — for a create, the user means a specific folder.
Sourcepub fn applicable_collections<'a>(
&'a self,
record_folder: &str,
projected: &Record,
vault_root: &Path,
) -> Result<Vec<&'a CollectionSchema>>
pub fn applicable_collections<'a>( &'a self, record_folder: &str, projected: &Record, vault_root: &Path, ) -> Result<Vec<&'a CollectionSchema>>
Every collection that applies to a record at record_folder
carrying the given fields.
A collection applies when:
- its
folderis==record_folderor an ancestor of it ("Notes"is an ancestor of"Notes/movie"); AND - every parsed
filter:expression evaluates true against the projected record. Filter parsing failures abort withSchemaError— we’d rather block a write than silently treat a broken filter as “no filter.”
Unlike collections_for_folder, this picks ancestors, not
descendants — given a record, “which collections govern me?”
rather than “which collections live under this folder?”.
Trait Implementations§
Source§impl Clone for VaultSchema
impl Clone for VaultSchema
Source§fn clone(&self) -> VaultSchema
fn clone(&self) -> VaultSchema
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more