Skip to main content

apply_record_batch

Function apply_record_batch 

Source
pub fn apply_record_batch(
    rows: &[Value],
    writes: &[Value],
    records: Option<&Value>,
    me: Option<&str>,
    now: &str,
    new_id: impl FnMut(usize) -> String,
) -> Result<(Vec<Value>, Vec<String>), String>
Expand description

Apply a batch of writes ({op: "upsert", kind, data, id?} | {op: "delete", id}) to rows ({id, kind, data, createdBy, createdAt, updatedAt}), all or nothing: the new rows and each write’s id, or the first refusal (write <i>: …). A patch merges onto its row and the merged row is checked; a create’s id is new_id(<i-th create>), its createdBy = me, every touched row stamped now.