pub struct UpdateBuilder { /* private fields */ }Expand description
Build an update mutation. The filter selects records; the chained
set/unset/add_tag/remove_tag calls accumulate operations applied
to each matching record’s frontmatter.
Implementations§
Source§impl UpdateBuilder
impl UpdateBuilder
pub fn new(folder: impl Into<String>, filter: Expr) -> Self
pub fn set(self, field: impl Into<String>, value: Value) -> Self
pub fn unset(self, field: impl Into<String>) -> Self
pub fn add_tag(self, tag: impl Into<String>) -> Self
pub fn remove_tag(self, tag: impl Into<String>) -> Self
Sourcepub fn with_vault_schema(self, schema: VaultSchema) -> Self
pub fn with_vault_schema(self, schema: VaultSchema) -> Self
Attach the vault-wide schema. When set, every matched record’s
post-update field map is validated against all applicable
collections (folder ancestor + filter match) before the writer
runs. A record whose projected state would violate any
applicable collection is reported as a MutationError and
skipped — the rest of the batch still proceeds. Strict mode:
the whole projected record must validate, so pre-existing
violations surface on the first update touching the record.
Sourcepub fn write_options(self, opts: WriteOptions) -> Self
pub fn write_options(self, opts: WriteOptions) -> Self
Replace the writer::WriteOptions used by execute. See its
docs for what each field controls. Defaults to fast (no fsync).
Sourcepub fn fsync(self, yes: bool) -> Self
pub fn fsync(self, yes: bool) -> Self
Convenience: enable durable writes (fsync data + parent dir).
Equivalent to .write_options(WriteOptions::durable()).
Sourcepub fn plan(&self, vault: &Vault) -> Result<MutationReport>
pub fn plan(&self, vault: &Vault) -> Result<MutationReport>
Compute the report without writing.
Sourcepub fn execute(self, vault: &Vault) -> Result<MutationReport>
pub fn execute(self, vault: &Vault) -> Result<MutationReport>
Plan, then apply each computed WriteResult to disk.
Holds the vault-scoped exclusive lock (see crate::lock) for the
entire duration of compute + writes, so concurrent mutations from
other vaultdb-core consumers serialize cleanly. Each individual
file write is atomic via tempfile+rename — readers never see a
partial write.
Trait Implementations§
Source§impl Clone for UpdateBuilder
impl Clone for UpdateBuilder
Source§fn clone(&self) -> UpdateBuilder
fn clone(&self) -> UpdateBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more