threatgrid / asami

A graph store for Clojure and ClojureScript
Eclipse Public License 1.0
634 stars 29 forks source link

Add transaction options to indicate updates on entity attributes #212

Open quoll opened 3 years ago

quoll commented 3 years ago

Right now entities can be marked for update via replacement annotations. This can be left in place, but we also want to add in the option to mark entities as single-cardinality via a temporary schema during a transaction. This can be passed as a field in the tx-info argument of transact.

For instance, instead of the annotated fields of :name' and :income' in the example for replacement annotations we can have:

(d/transact conn
            {:tx-data [{:db/ident "will" :name "Fitzwilliam" :county "Derbyshire" :income 10000}]
             :schema [{:db/ident :name :db/cardinality :db.cardinality/one}
                      {:db/ident :income :db/cardinality :db.carinality/one})