Skip to main content

Module tx

Module tx 

Source
Expand description

Transaction data as builder-patterned values.

A TxBuilder assembles the Datomic-dialect transaction forms corium accepts — map forms with :db/id, and the list ops [:db/add …], [:db/retract …], [:db/cas …], [:db/retractEntity …] — into a TxData value ready to submit through a crate::Peer.

use corium_client::tx::{TxBuilder, EntityMap, tempid, lookup};

let tx = TxBuilder::new()
    .entity(
        EntityMap::with_id(tempid("alice"))
            .set("person/name", "Alice")
            .set("person/age", 39_i64),
    )
    .add(lookup("person/email", "bob@example.com"), "person/age", 40_i64)
    .build();

Structs§

EntityMap
A map-form entity: {:db/id … :attr value …}. Without an id the transactor allocates a fresh entity.
TxBuilder
Builds a TxData value from transaction forms.
TxData
A completed set of transaction forms, ready to submit through a crate::Peer.

Functions§

eid
An #eid reference to a raw entity id, for entity positions where a bare long would be ambiguous.
lookup
A lookup ref [:attr value] naming an existing entity by a unique attribute value.
tempid
A string tempid such as "alice", unified with an allocated entity id after the transaction commits.