Skip to main content

build_write_batch

Function build_write_batch 

Source
pub fn build_write_batch(
    resolved: &Resolved,
    body: &[u8],
) -> Result<WriteBatch, RequestError>
Expand description

Builds the single-document write batch for a resolved ingest request.

Applies the body transform by scanning and splicing the raw bytes, never parsing the body into a Value tree or re-serializing it (ADR-014): an injected field is written right after the opening {, an id is read straight from the bytes, and an untransformed body is forwarded verbatim.

ยงErrors

Returns RequestError::Rewrite if the body is not a JSON object, a reserved field collides, or an id template fails to expand; RequestError::Internal if a decision carries an unresolved injected value (the tenancy adapter resolves these, so this indicates a bug).