Liking cljdoc? Tell your friends :D
Mostly cljs.
Exceptions indicated.

trident.datascript

cljs

Frontend tools for syncing Datascript with Datomic.

Frontend tools for syncing Datascript with Datomic.
raw docstring

defqclj/smacro

(defq sym & forms)

Defines a reactive atom backed by a Datascript query.

sym, the reactive atom, will contain the result of forms. sym will be updated whenever transact! or init-from-datomic! are called.

Although it's intended that forms contains a Datascript query, you can put anything in there.

Defines a reactive atom backed by a Datascript query.

`sym`, the reactive atom, will contain the result of `forms`. `sym` will be
updated whenever [[transact!]] or [[init-from-datomic!]] are called.

Although it's intended that `forms` contains a Datascript query, you can put
anything in there.
sourceraw docstring

eid-mappingcljs

(eid-mapping datascript-tx-result datomic-ids)

Returns a map from Datascript EIDs to Datomic EIDs.

datomic-tempids is a function from tempids in datascript-tx-result to Datomic EIDs.

Returns a map from Datascript EIDs to Datomic EIDs.

`datomic-tempids` is a function from tempids in `datascript-tx-result` to
Datomic EIDs.
sourceraw docstring

init-from-datomic!cljs

(init-from-datomic! conn datoms)

Loads Datomic datoms into a Datascript conn.

Stores Datomic EIDs for use by transact!. The Datomic EIDs must be sent from the backend as tagged literals; see transact!.

Loads Datomic datoms into a Datascript `conn`.

Stores Datomic EIDs for use by [[transact!]]. The Datomic EIDs must be sent
from the backend as tagged literals; see [[transact!]].
sourceraw docstring

transact!cljs

(transact! persist-fn conn tx & queries)

Transacts tx to conn, keeping EIDs in sync with Datomic.

persist-fn is a function which takes tx, persists to Datomic, and returns a channel which will deliver the value of :tempids from the Datomic transaction result.

Before passing tx to persist-fn, Datascript EIDs will be changed to Datomic EIDs (stored from previous transactions). Datomic IDs are represented as tagged literals, e.g. #trident/eid "12345". The backend should encode (and decode) EIDs in this form because Datomic entity IDs can be larger than Javascript's Number.MAX_SAFE_INTEGER.

On the backend, include {trident/eid trident.util/parse-int} in data_readers.clj. On the frontend, include the following when you call read-string: {:readers {'trident/eid #(tagged-literal 'trident/eid %)}}

Note: currently, if tx includes new entities, they must have an explicit tempid, e.g. {:db/id "tmp", :foo "bar"} instead of just {:foo "bar"}.

Transacts `tx` to `conn`, keeping EIDs in sync with Datomic.

`persist-fn` is a function which takes `tx`, persists to Datomic, and returns
a channel which will deliver the value of `:tempids` from the Datomic
transaction result.

Before passing `tx` to `persist-fn`, Datascript EIDs will be changed to
Datomic EIDs (stored from previous transactions). Datomic IDs are represented
as tagged literals, e.g. `#trident/eid "12345"`. The backend should encode
(and decode) EIDs in this form because Datomic entity IDs can be larger than
Javascript's `Number.MAX_SAFE_INTEGER`.

On the backend, include `{trident/eid trident.util/parse-int}` in
`data_readers.clj`. On the frontend, include the following when you call
`read-string`: `{:readers {'trident/eid #(tagged-literal 'trident/eid %)}}`

Note: currently, if `tx` includes new entities, they must have an explicit
tempid, e.g. `{:db/id "tmp", :foo "bar"}` instead of just
`{:foo "bar"}`.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close