workflo.macros.entity.datomic

attr->field

(attr->field [attr-name [attr-type & attr-opts]])

Returns an attribute name and definition pair. Returns a pair suitable to be passed to datomic-schema’s schema* function as a field.

datomic-schema

(datomic-schema [prefix schema])

Generates a Datomic schema from an entity schema with a specific prefix.

entity-schema

(entity-schema entity)

Returns the Datomic schema for an entity.

merge-schemas

(merge-schemas schemas)(merge-schemas schemas merge-fn)

Merge multiple Datomic schemas so that there are no conflicting attributes. The default behavior is to throw an exception if two schemas for the same attribute are different.

normalize-attr

(normalize-attr attr)

Normalizes a Datomic schema attribute by converting it to a map if it’s of the form [:db/add ...].

split-schema

(split-schema schema)

Takes an entity schema and splits it into multiple entity schemas based on attribute prefixes. An entity with a spec like

(s/keys :req [:foo/bar :baz/ruux])

would yield an entity schema like

{:foo/bar [...]
 :baz/ruux [...]}

and would be split into

{:foo {:foo/bar [...]}
 :baz {:bar/ruux [...]}}