(as-of db-value t)Returns the value of the database as of some point t, inclusive.
t may be a transaction number, transaction entity id, lookup ref, Date,
or Instant.
Returns the value of the database as of some point `t`, inclusive. `t` may be a transaction number, transaction entity id, lookup ref, `Date`, or `Instant`.
(as-of-t db-value)Returns the as-of point, or nil if none.
Returns the as-of point, or nil if none.
(attribute db attrid)Returns attribute metadata for an ident, schema entity id, or Mila aid.
Returns attribute metadata for an ident, schema entity id, or Mila aid.
(basis-t db-value)Returns the tx-id of the most recent transaction reachable via this db value.
For as-of db values this is the pinned tx-id.
Returns the tx-id of the most recent transaction reachable via this db value. For `as-of` db values this is the pinned tx-id.
System schema for keyed, content-addressed blobs.
Intended usage:
System schema for keyed, content-addressed blobs.
Intended usage:
- Install once: (transact conn blob-schema)
- Create: {:miladb.blob/key :docs/readme, :miladb.blob/data bytes}
- Lookup: (entity db [:miladb.blob/key :docs/readme])(closed? conn)(conn? v)(connect path)(connect path opts)Open an existing MilaDB database file.
The target file must already have been initialized via create-database.
Supported options include the underlying bbolt write options such as :no-sync.
:tx-report :early causes tx-report-queue publication to happen before the
final durability flush when sync is otherwise enabled. The default is
:tx-report :after-sync.
Transactions (transact) block until the flush completes, but queue consumers
can observe the tx-report before flushing is completed. The default is
:tx-report :after-sync.
With :no-sync true, :tx-report has no effect.
Open an existing MilaDB database file. The target file must already have been initialized via `create-database`. Supported options include the underlying bbolt write options such as `:no-sync`. `:tx-report :early` causes `tx-report-queue` publication to happen before the final durability flush when sync is otherwise enabled. The default is `:tx-report :after-sync`. Transactions (`transact`) block until the flush completes, but queue consumers can observe the tx-report before flushing is completed. The default is `:tx-report :after-sync`. With `:no-sync true`, `:tx-report` has no effect.
(create-database path)(create-database path opts)Create and initialize a MilaDB database file.
When opts contains :schema, install that user schema during initialization.
Create and initialize a MilaDB database file. When `opts` contains `:schema`, install that user schema during initialization.
(datoms db index & components)Return datoms for an index and optional components.
Components are interpreted in logical datom order for the selected index:
:eavt: [e a v tx]:aevt: [a e v tx]:avet: [a v e tx]:vaet: [v a e tx]Supplied components narrow the result by matching a leading prefix of that logical order.
:eavt and :aevt contain all datoms.:avet contains datoms for attributes where :db/index or :db/unique
is true.:vaet contains datoms for reference attributes and serves as the reverse
index.Returns a realized seq of datoms.
Return datoms for an index and optional components. Components are interpreted in logical datom order for the selected index: - `:eavt`: `[e a v tx]` - `:aevt`: `[a e v tx]` - `:avet`: `[a v e tx]` - `:vaet`: `[v a e tx]` Supplied components narrow the result by matching a leading prefix of that logical order. - `:eavt` and `:aevt` contain all datoms. - `:avet` contains datoms for attributes where `:db/index` or `:db/unique` is true. - `:vaet` contains datoms for reference attributes and serves as the reverse index. Returns a realized seq of datoms.
(db conn)Return the current db value for a connection.
Return the current db value for a connection.
(entid db ident)Returns the entity id associated with a symbolic keyword, or the id itself if passed.
Returns the entity id associated with a symbolic keyword, or the id itself if passed.
(entity db eid)Return an entity view for an id, ident, or lookup ref.
Return an entity view for an id, ident, or lookup ref.
(entity-db entity)Returns the database value that is the basis for this entity.
Returns the database value that is the basis for this entity.
(ident db eid)Returns the keyword associated with an id, or the key itself if passed.
Returns the keyword associated with an id, or the key itself if passed.
(pull-many db pattern eids & {:as options})Pull many entities
Pull many entities
(q query & args)(query-stats query & args)(remove-tx-report-queue conn queue)Detach the shared tx report queue from conn.
Detach the shared tx report queue from `conn`.
(seek-datoms db index & components)Seek into an index and return a reducible datom scan source.
Unlike datoms, the supplied components establish the initial search
position and does not bind the result. Iteration continues to the end of the
physical index unless the reduction terminates early!
WARNING: each reduction holds a read transaction open for the duration of the
reduction. Prefer into/transduce with take, take-while, or another
early-terminating transducer when possible.
ATTENTION: Leaky abstraction of physical on-disk layout! Accepted component shapes must align to a true leading prefix of the physical index keys:
:eavt: [], [e], [e a] on-disk layout: (e, a, t*, retract?, v):aevt: [], [a], [a e] on-disk layout: (a, e, t*, retract?, v):avet: [], [a], [a v], [a v e] on-disk layout: (a, v, e, t*):vaet: [], [v a], [v a e] on-disk layout: (v, a, e, t*)Seek into an index and return a reducible datom scan source. Unlike `datoms`, the supplied components establish the initial search position and does not bind the result. Iteration continues to the end of the physical index unless the reduction terminates early! WARNING: each reduction holds a read transaction open for the duration of the reduction. Prefer `into`/`transduce` with `take`, `take-while`, or another early-terminating transducer when possible. ATTENTION: Leaky abstraction of physical on-disk layout! Accepted component shapes must align to a true leading prefix of the physical index keys: - `:eavt`: `[]`, `[e]`, `[e a]` on-disk layout: `(e, a, t*, retract?, v)` - `:aevt`: `[]`, `[a]`, `[a e]` on-disk layout: `(a, e, t*, retract?, v)` - `:avet`: `[]`, `[a]`, `[a v]`, `[a v e]` on-disk layout: `(a, v, e, t*)` - `:vaet`: `[]`, `[v a]`, `[v a e]` on-disk layout: `(v, a, e, t*)`
(since db-value tx-id)Return a db value filtered since a tx-id.
Return a db value filtered since a tx-id.
(touch entity)Touch an entity to realize attributes and return a realized entity map.
Touch an entity to realize attributes and return a realized entity map.
(transact conn tx-data)Given a connection and a set of information (tx-data), submits
a transaction and blocks until a result is available. transact
updates the connection's shared reference to the current database
value by swapping in the :db-after value produced by with.
Returns a transaction report map. The report includes at least
:db-before, :db-after, :tx-data, :tempids, and :tx-id.
tx-data follows the same transaction forms accepted by with,
including entity maps and transaction operation vectors such as
:db/add, :db/retract, :db.fn/retractEntity, and
:db.fn/retractAttribute.
An exception indicates that the transaction failed and no result was committed.
If a tx report queue is attached via tx-report-queue, the
transaction report is also published there.
Given a connection and a set of information (`tx-data`), submits a transaction and blocks until a result is available. `transact` updates the connection's shared reference to the current database value by swapping in the `:db-after` value produced by `with`. Returns a transaction report map. The report includes at least `:db-before`, `:db-after`, `:tx-data`, `:tempids`, and `:tx-id`. `tx-data` follows the same transaction forms accepted by `with`, including entity maps and transaction operation vectors such as `:db/add`, `:db/retract`, `:db.fn/retractEntity`, and `:db.fn/retractAttribute`. An exception indicates that the transaction failed and no result was committed. If a tx report queue is attached via `tx-report-queue`, the transaction report is also published there.
(tx-report-queue conn)Register or return the shared buffered tx report queue for conn.
Register or return the shared buffered tx report queue for `conn`.
(with db tx-data)Apply a transaction to a db value without persisting it.
Apply a transaction to a db value without persisting it.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |