Liking cljdoc? Tell your friends :D

trident.util.datomic

Utility functions for working with Datomic.

Only includes functions that don't depend on Datomic APIs.

Utility functions for working with Datomic.

Only includes functions that don't depend on Datomic APIs.
raw docstring

composite-keysclj/s

(composite-keys m)
source

datascript-schemaclj/s

(datascript-schema compact-schema)

Generate Datascript schema from a compact schema format. See datomic-schema.

Generate Datascript schema from a compact schema format.
See [[datomic-schema]].
sourceraw docstring

datomic-schemaclj/s

(datomic-schema compact-schema)

Generate Datomic schema from a compact schema format.

compact-schema is a map from idents to flags. See expand-flags. Example:

(datomic-schema {:foo [:db.type/string :db.unique/identity]
                 :bar [:db.type/long :db.cardinality/many]})
=> (#:db{:ident :foo,
         :cardinality :db.cardinality/one,
         :valueType :db.type/string
         :unique :db.unique/identity}
    #:db{:ident :bar,
         :cardinality :db.cardinality/many,
         :valueType :db.type/long})
Generate Datomic schema from a compact schema format.

`compact-schema` is a map from idents to flags. See [[expand-flags]]. Example:
```
(datomic-schema {:foo [:db.type/string :db.unique/identity]
                 :bar [:db.type/long :db.cardinality/many]})
=> (#:db{:ident :foo,
         :cardinality :db.cardinality/one,
         :valueType :db.type/string
         :unique :db.unique/identity}
    #:db{:ident :bar,
         :cardinality :db.cardinality/many,
         :valueType :db.type/long})
```
sourceraw docstring

defspecsclj/smacro

(defspecs sym m)
source

ent-keysclj/s

(ent-keys req)
(ent-keys req opt)

Like clojure.spec.alpha/keys, but only allow keys in req or opt.

Intended for use with a pulled entity. Handles cardinality many values correctly. Only checks the current entity; the values of any :db.type/ref attributes will be assumed valid.

Like `clojure.spec.alpha/keys`, but only allow keys in `req` or `opt`.

Intended for use with a `pull`ed entity. Handles cardinality many values
correctly. Only checks the current entity; the values of any `:db.type/ref`
attributes will be assumed valid.
sourceraw docstring

ephemeralclj/s

(ephemeral m)
source

eval-tx-fnsclj

(eval-tx-fns db tx)

Evaluate any transaction functions in tx, returning transaction data.

Only works with classpath transaction functions, not database functions.

Evaluate any transaction functions in `tx`, returning transaction data.

Only works with classpath transaction functions, not database functions.
sourceraw docstring

expand-flagsclj/s

(expand-flags flags)

Generate Datomic schema from a collection of flags.

Example:

(expand-flags [:foo :db.type/string :db.cardinality/one
               "this is a foo" [:db/id "some-id"]])
=> #:db{:ident :foo,
        :valueType :db.type/string,
        :cardinality :db.cardinality/one,
        :doc "this is a foo",
        :id "some-id"}
Generate Datomic schema from a collection of flags.

Example:
```
(expand-flags [:foo :db.type/string :db.cardinality/one
               "this is a foo" [:db/id "some-id"]])
=> #:db{:ident :foo,
        :valueType :db.type/string,
        :cardinality :db.cardinality/one,
        :doc "this is a foo",
        :id "some-id"}
```
sourceraw docstring

merge-schemaclj/s

(merge-schema & ms)
source

specsclj/s

(specs m)
source

tag-eidsclj/s

(tag-eids ds-schema datoms)

Convert all EIDs in datoms to tagged literals.

ds-schema: Datascript schema.

For example, 123 would become #trident/eid "123".

Convert all EIDs in `datoms` to tagged literals.

`ds-schema`: Datascript schema.

For example, `123` would become `#trident/eid "123"`.
sourceraw docstring

translate-eidsclj/s

(translate-eids ds-schema eids tx)
source

wrap-collclj/s

(wrap-coll ent-value)

Ensure that ent-value is wrapped in a vector or set.

Needed because Datomic pull wraps values in collections only sometimes, depending on attribute cardinality.

Ensure that `ent-value` is wrapped in a vector or set.

Needed because Datomic `pull` wraps values in collections only sometimes,
depending on attribute cardinality.
sourceraw docstring

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

× close