(as-of db t)
Returns a historical database value at some point in time t
, inclusive.
t
can be a transaction number or a transaction id
Returns a historical database value at some point in time `t`, inclusive. `t` can be a transaction number or a transaction id
(as-of-t db)
If db
isn't the latest snapshot at the time it was constructed, return the
tx-num
of the log entry / transaction that db
was constructed from to reflect; else nil
If `db` isn't the latest snapshot at the time it was constructed, return the `tx-num` of the log entry / transaction that `db` was constructed from to reflect; else `nil`
(attribute db attr-id)
Retrieves information about an Attribute
.
Retrieves information about an `Attribute`.
(attribute-strict db attr-id)
Retrieves information about an Attribute
. Exception is thrown if none exists
Retrieves information about an `Attribute`. Exception is thrown if none exists
(basis-t db)
Return the latest tx-num
the Peer
knew about at the time db
was constructed; else nil
Return the latest `tx-num` the `Peer` knew about at the time `db` was constructed; else `nil`
(connect uri)
Returns a Connection
, given a valid connection configuration map.
Returns a `Connection`, given a valid connection configuration map.
(connection-status conn)
Returns status information on a given Connection
Returns status information on a given `Connection`
(datoms db index & components)
Provides raw access to the database indexes. Must pass the index-name. May pass one or more leading components of the index to constrain the results.
The following indexes may be searched:
:eavt
- contains all datoms sorted by entity-id, attribute-id, value, and transaction:aevt
- contains all datoms sorted by attribute-id, entity-id, value, and transaction:avet
- contains datoms with indexed and unique attributes (except for bytes values)
sorted by attribute-id, value, entity-id, and transaction:vaet
- contains datoms with attributes of :db.type/ref; VAET acts as the reverse
index for backwards traversal of refsProvides raw access to the database indexes. Must pass the index-name. May pass one or more leading components of the index to constrain the results. The following indexes may be searched: - `:eavt` - contains all datoms sorted by entity-id, attribute-id, value, and transaction - `:aevt` - contains all datoms sorted by attribute-id, entity-id, value, and transaction - `:avet` - contains datoms with indexed and unique attributes (except for bytes values) sorted by attribute-id, value, entity-id, and transaction - `:vaet` - contains datoms with attributes of :db.type/ref; VAET acts as the reverse index for backwards traversal of refs
(db conn)
Yields the most recently known database snapshot, which is maintained in memory.
Yields the most recently known database snapshot, which is maintained in memory.
(db-snapshot conn)
Yields the most recently known database snapshot, which is maintained in memory.
Yields the most recently known database snapshot, which is maintained in memory.
(entid db identifier)
Coerces any entity-identifier into an entity-id. Does not confirm existence of an entity id, except incidentally through some coercion processes. To check for existence of an entity, please use isExtantEntity
Coerces any entity-identifier into an entity-id. Does **not** confirm existence of an entity id, except incidentally through some coercion processes. To check for existence of an entity, please use [isExtantEntity](#var-extant-entity.3F)
(entid-strict db identifier)
Behaves the same as entid
, but instead throws where entid
would return nil.
Behaves the same as [`entid`](#var-entid), but instead throws where `entid` would return nil.
(entity db eid)
Returns an Entity
, which is a dynamic, lazy-loaded projection of the datoms
that share the same entity-id
Returns an `Entity`, which is a dynamic, lazy-loaded projection of the datoms that share the same entity-id
(entity-db entity)
Returns the database value that backs this entity
Returns the database value that backs this entity
(extant-entity? db identifier)
Returns true if there exists at least one datom in the database with the provided entity identifier.
Returns true if there exists at least one datom in the database with the provided entity identifier.
(function m)
[Datomic Documentation](https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/function)
(history db)
Returns a special view of the database containing all datoms, asserted
or retracted across time. Currently supports the datoms
and q
functions.
Returns a special view of the database containing **all** datoms, asserted or retracted across time. Currently supports the [`datoms`](#var-datoms) and [`q`](#var-q) functions.
(ident db id)
Returns the keyword-identifier
associated with an id.
Returns the `keyword-identifier` associated with an id.
(ident-strict db id)
Returns the keyword-identifier
associated with an id. Exception is thrown if none exists
Returns the `keyword-identifier` associated with an id. Exception is thrown if none exists
(invoke db eid-or-ident & args)
Looks up a database function identified by the eid
or ident
and invokes
the function with the provided args
Looks up a database function identified by the `eid` or `ident` and invokes the function with the provided `args`
(latest-t conn)
Returns the t
of the most recent transaction reachable via this db
value.
Returns the `t` of the most recent transaction reachable via this `db` value.
(log conn)
Returns the current value of the transaction log.
Communicates with storage, but not with the transactor
Returns the current value of the transaction log. Communicates with storage, but not with the transactor Can be used in conjunction with [`tx-range`](#var-tx-range) or a [`query`](#var-q).
(part eid)
Return the partition associated with the specified entity id.
Return the partition associated with the specified entity id.
(pull db pattern eid)
Executes a pull-query returning a hierarchical selection of attributes for entityId
Executes a pull-query returning a hierarchical selection of attributes for entityId
(pull-many db pattern eids)
Returns multiple hierarchical selections for the passed entity-identifiers
Returns multiple hierarchical selections for the passed entity-identifiers
(q query & inputs)
[Datomic Documentation](https://docs.datomic.com/on-prem/clojure/index.html#datomic.api/q)
(release conn)
Releases the resources associated with this Connection
.
Connections are intended to be long-lived, so you should release
a Connection
only when the entire program is finished with it
(for example at program shutdown).
Releases the resources associated with this `Connection`. Connections are intended to be long-lived, so you should release a `Connection` only when the entire program is finished with it (for example at program shutdown).
(resolve-tempid db tempids)
(resolve-tempid db tempids tempid)
Resolves a temporary-id to a permanent id given a database and a mapping of tempid to permids.
Intended for use with the results of a transact
call:
(let [tid (eva/tempid :db.part/user -1)
result @(eva/transact conn [[:db/add tid :db/ident :foo]])]
{:temp-id tid
:perm-id (eva/resolve-tempid (:db-after result) (:tempids result) tid)})
If a tempid is not passed, then a function is returned that will resolve tempids using the given db and tempids-mapping. This form should be used when resolving a collection of tempids.
(let [t1 (eva/tempid :db.part/user -1)
t2 (eva/tempid :db.part/user -2)
t3 (eva/tempid :db.part/user -3)
result @(eva/transact conn [[:db/add t1 :db/ident :foo]
[:db/add t2 :db/ident :bar]
[:db/add t3 :db/ident :baz]])]
(map (eva/resolve-tempid (:db-after result) (:tempids result)) [t1 t2 t3]))
Resolves a temporary-id to a permanent id given a database and a mapping of tempid to permids. Intended for use with the results of a [`transact`](#var-transact) call: ```clj (let [tid (eva/tempid :db.part/user -1) result @(eva/transact conn [[:db/add tid :db/ident :foo]])] {:temp-id tid :perm-id (eva/resolve-tempid (:db-after result) (:tempids result) tid)}) ``` If a tempid is not passed, then a function is returned that will resolve tempids using the given db and tempids-mapping. This form should be used when resolving a collection of tempids. ```clj (let [t1 (eva/tempid :db.part/user -1) t2 (eva/tempid :db.part/user -2) t3 (eva/tempid :db.part/user -3) result @(eva/transact conn [[:db/add t1 :db/ident :foo] [:db/add t2 :db/ident :bar] [:db/add t3 :db/ident :baz]])] (map (eva/resolve-tempid (:db-after result) (:tempids result)) [t1 t2 t3])) ```
(snapshot-t db)
Return the tx-num
of the log entry / transaction that db
constructed from to reflect; else nil
Return the `tx-num` of the log entry / transaction that `db` constructed from to reflect; else `nil`
(squuid)
Constructs a semi-sequential UUID
. Can be useful for having a unique
identifier that does not fragment indexes
Constructs a semi-sequential `UUID`. Can be useful for having a unique identifier that does not fragment indexes
(squuid-time-millis uuid)
Returns the time component of a squuid
, in the format of
System.currentTimeMillis
Returns the time component of a [`squuid`](#var-squuid), in the format of `System.currentTimeMillis`
(sync-db conn)
Like db-snapshot
, but forces reads from the backing store to assert whether or
not the in-memory database snapshot is stale before returning. If the
snapshot is found to be stale, this call will block until the updated
snapshot is produced from storage.
Communicates only with storage.
Intended for use when stale state on a Peer
is suspected.
Like [`db-snapshot`](#var-db-snapshot), but forces reads from the backing store to assert whether or not the in-memory database snapshot is stale before returning. If the snapshot is found to be stale, this call will block until the updated snapshot is produced from storage. Communicates only with storage. Intended for use when stale state on a `Peer` is suspected.
(tempid part)
(tempid part n)
Construct a temporary id within the specified partition. Tempids will be mapped to permanent ids within a single transaction.
User-created tempids are reserved for values of n
within the range of -1 to -1000000 inclusive.
Construct a temporary id within the specified partition. Tempids will be mapped to permanent ids within a single transaction. User-created tempids are reserved for values of `n` within the range of -1 to -1000000 inclusive.
(to-tx-eid tx-num-or-eid)
Takes a tx-num
or tx-eid
and returns the equivalent tx-eid
Takes a `tx-num` or `tx-eid` and returns the equivalent `tx-eid`
(to-tx-num tx-num-or-eid)
Takes a tx-num
or tx-eid
and returns the equivalent tx-num
Takes a `tx-num` or `tx-eid` and returns the equivalent `tx-num`
(touch entity)
Loads all attributes of the entity, recursively touching any component entities
Loads all attributes of the entity, recursively touching any component entities
(transact conn tx-data)
Submits a transaction, blocking until a result is available.
tx-data
is a list of operations to be processed, including assertions,
retractions, functions, or entity-maps
Returns a CompletableFuture which can monitor the status of the transaction. On successful commit, the future will contain a map of the following keys:
:db-before
database value before transaction was applied:db-after
database value after transaction was applied:tx-data
collection of primitive operations performed by the transaction:temp-ids
can be used with resolveTempId
to
resolve temporary ids used in the txDataIf the transaction fails or timed out, attempts to .get() the future's value
will raise an ExecutionException
.
When getting the result of the future, catch ExecutionException
and call
ExecutionException#getCause()
to retrieve the underlying error.
Submits a transaction, blocking until a result is available. `tx-data` is a list of operations to be processed, including assertions, retractions, functions, or entity-maps Returns a CompletableFuture which can monitor the status of the transaction. On successful commit, the future will contain a map of the following keys: - `:db-before` database value before transaction was applied - `:db-after` database value after transaction was applied - `:tx-data` collection of primitive operations performed by the transaction - `:temp-ids` can be used with [`resolveTempId`](#var-resolve-tempid) to resolve temporary ids used in the txData If the transaction fails or timed out, attempts to .get() the future's value will raise an `ExecutionException`. When getting the result of the future, catch `ExecutionException` and call `ExecutionException#getCause()` to retrieve the underlying error.
(transact-async conn tx-data)
Like transact
but returns immediately without waiting for
the transaction to complete.
Like [`transact`](#var-transact) but returns immediately without waiting for the transaction to complete.
(tx-range log start end)
Given a Log
object and a start and end transaction number
or id
, return all
applicable datoms that were asserted or retracted in the database.
Given a `Log` object and a start and end `transaction number` or `id`, return all applicable datoms that were asserted or retracted in the database.
(with db tx-data)
Simulates a transaction locally without persisting the updated state.
Returns a map with the same contents as the future from transact
Simulates a transaction locally without persisting the updated state. Returns a map with the same contents as the future from [`transact`](#var-transact)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close