A set of helper functions for when working with Datomic.
A set of helper functions for when working with Datomic.
(are-attributes-retracted-since conn entid attrs since-inst)
Returns true if the entity with ID entid has attributes attrs all retracted as of since-inst. Otherwise returns false.
Returns true if the entity with ID entid has attributes attrs all retracted as of since-inst. Otherwise returns false.
(change-log-since conn
since-inst
reqd-attr
reqd-attr-val
updated-entry-maker-fn
deleted-entry-maker-fn)
Returns a map with 2 keys: :updates and :deletions. The value at each key is a vector of entities that have either been updated (add/update) or deleted as of since-inst. Each vector contains a collection of entries as maps. filter-fn will be invoked for each candidate entity and will return a boolean indicating if it should be included in the final set. The parameters updated-entry-maker-fn and deleted-entry-maker-fn are used to construct the maps. updated-entry-maker-fn will be used to contruct the maps to go into the :updates vector; deleted-entry-maker-fn will be used to construct the maps to go into the :deletions vector. Each of these functions will receive the populated Datomic entity, and is to return a map. Updates and deletions of entities containing reqd-attr will be included in the computation.
Returns a map with 2 keys: :updates and :deletions. The value at each key is a vector of entities that have either been updated (add/update) or deleted as of since-inst. Each vector contains a collection of entries as maps. filter-fn will be invoked for each candidate entity and will return a boolean indicating if it should be included in the final set. The parameters updated-entry-maker-fn and deleted-entry-maker-fn are used to construct the maps. updated-entry-maker-fn will be used to contruct the maps to go into the :updates vector; deleted-entry-maker-fn will be used to construct the maps to go into the :deletions vector. Each of these functions will receive the populated Datomic entity, and is to return a map. Updates and deletions of entities containing reqd-attr will be included in the computation.
(entities-of-attrs-since conn attrs since-inst)
Returns the set of entity IDs (including retracted ones) that contains at least one attribute from attrs, and exists as of since-inst.
Returns the set of entity IDs (including retracted ones) that contains at least one attribute from attrs, and exists as of since-inst.
(entities-updated-since conn since-inst reqd-attr reqd-attr-val)
(entities-updated-since conn since-inst reqd-attr reqd-attr-val transform-fn)
Returns the set of entity IDs that contain the attribute reqd-attr, and exist since since-inst. If transform-fn is supplied, it will be applied against each found entity.
Returns the set of entity IDs that contain the attribute reqd-attr, and exist since since-inst. If transform-fn is supplied, it will be applied against each found entity.
(entities-updated-since-2 conn since-inst reqd-attr reqd-attr-val)
(entities-updated-since-2 conn since-inst reqd-attr reqd-attr-val transform-fn)
(entity-for-parent-by-id conn parent-entid entity-entid parent-attr)
Returns a vector where the 1st element is an entity id, and the 2nd element the corresponding entity map. The entity information returned is a direct child entity of the entity with entity id entity-entid.
Returns a vector where the 1st element is an entity id, and the 2nd element the corresponding entity map. The entity information returned is a direct child entity of the entity with entity id entity-entid.
(entity-id-for-schema-attribute conn attr)
Returns the entity ID of attr.
Returns the entity ID of attr.
(get-user-schema-version conn user-schema-attr-name)
Returns the schema version of the database associated with conn (assumes the schema attribute was installed using transact-user-schema-attribute).
Returns the schema version of the database associated with conn (assumes the schema attribute was installed using transact-user-schema-attribute).
(refresh-db db-uri schema-files)
First deletes the database at db-uri, then creates it, and then transacts the set of schema files.
First deletes the database at db-uri, then creates it, and then transacts the set of schema files.
(save-new-entity conn txnmap)
Transacts txnmap using conn and returns the generated entity id.
Transacts txnmap using conn and returns the generated entity id.
(transact-partition conn partition)
Transacts the given partition using conn.
Transacts the given partition using conn.
(transact-schema-files conn schema-files)
Transacts the set of schema files using conn. Each schema file is assumed to be on the classpath, and contains a single transaction.
Transacts the set of schema files using conn. Each schema file is assumed to be on the classpath, and contains a single transaction.
(transact-user-schema-attribute conn attr-ident)
Transacts a schema attribute with a :db/ident of attr-ident. This attribute is of type long and cardinality one. It's purpose is to capture the notion of a schema version; similar to SQLite's 'user_version' pragma.
Transacts a schema attribute with a :db/ident of attr-ident. This attribute is of type long and cardinality one. It's purpose is to capture the notion of a schema version; similar to SQLite's 'user_version' pragma.
(transact-user-schema-version conn partition user-schema-attr-name val)
Transacts a new schema version value val to the database associated with conn, in partition, where the schema attribute :db/ident is user-schema-attr-name.
Transacts a new schema version value val to the database associated with conn, in partition, where the schema attribute :db/ident is user-schema-attr-name.
(txn-time conn e)
(txn-time conn e since-inst)
Returns the transaction time (instance) of the given entity e.
Returns the transaction time (instance) of the given entity e.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close