Class: Connection

Connection()

new Connection()

A connection to a Datomic database.
Source:

Methods

db() → {Db}

Return the most recent known database value (does not communicate over the network).
Source:
Returns:
The database.
Type
Db

q(m) → {Promise.<channel.Channel>}

Query the database. Returns a promise that will yield a channel.Channel that can be read from to fetch results; in case of error, the promise will be rejected with the error. The argument map must contain the following keys:
  • query -- the query to run. See query.QueryBuilder for help building queries.
  • args -- arguments to the query (an array).
Also supports the following optional keys:
  • timeout -- query timeout in milliseconds. Default 60s.
  • offset -- the offset in the result set. Default 0.
  • limit -- the maximum number of results to read. Default 1000.
  • chunk -- the maximum number of results to return in each chunk. Default 1000.
Parameters:
Name Type Description
m The argument map.
Source:
Returns:
The promise yielding the channel of results.
Type
Promise.<channel.Channel>

recentDb() → {Promise.<Db>}

Sync with the most recent transaction on the server, and return a Db value with that state.
Source:
Returns:
The Db synced with the server.
Type
Promise.<Db>

sync(t) → {Promise.<Db>}

Return a database value synced to the current value t.
Parameters:
Name Type Description
t Number The database t value.
Source:
Returns:
The promise that yields the synced database.
Type
Promise.<Db>

transact(m) → {*}

Transact facts to the database. The argument is an object that should contain the key:
  • txData: an array representing the transaction.
Parameters:
Name Type Description
m
Source:
Returns:
Type
*

txRange(m) → {Promise.<channel.Channel>}

Get transactions from the transaction log. The argument supports the following keys:
  • start: The optional start date or t value.
  • end: The optional end date or t value.
  • timeout: query timeout in milliseconds. Default 60s.
  • offset: the offset in the result set. Default 0.
  • limit: the maximum number of results to read. Default 1000.
  • chunk: the maximum number of results to return in each chunk. Default 1000.
Parameters:
Name Type Description
m The arguments.
Source:
Returns:
The promise that yields the channel of chunks.
Type
Promise.<channel.Channel>

withDb() → {Promise.<Db>}

Return a promise that yields a database value that can be used to run a transaction without changing the database..
Source:
Returns:
The promise that yields the db.
Type
Promise.<Db>