Liking cljdoc? Tell your friends :D

miladb.api


as-ofclj

(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`.
raw docstring

as-of-tclj

(as-of-t db-value)

Returns the as-of point, or nil if none.

Returns the as-of point, or nil if none.
raw docstring

attributeclj

(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.
raw docstring

basis-tclj

(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.
raw docstring

blob-schemaclj

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])
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])
raw docstring

closed?clj

(closed? conn)

conn?clj

(conn? v)

connectclj

(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.
raw docstring

create-databaseclj

(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.
raw docstring

datomsclj

(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.
raw docstring

dbclj

(db conn)

Return the current db value for a connection.

Return the current db value for a connection.
raw docstring

db-statsclj

(db-stats db)

Queries for database stats.

Queries for database stats.
raw docstring

entidclj

(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.
raw docstring

entityclj

(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.
raw docstring

entity-dbclj

(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.
raw docstring

historyclj

(history db)

Return a history db view.

Return a history db view.
raw docstring

identclj

(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.
raw docstring

pullclj

(pull db pattern eid & {:as options})

Pull entity data

Pull entity data
raw docstring

pull-manyclj

(pull-many db pattern eids & {:as options})

Pull many entities

Pull many entities
raw docstring

qclj

(q query & args)

query-statsclj

(query-stats query & args)

releaseclj

(release conn)

Close a MilaDB connection.

Close a MilaDB connection.
raw docstring

remove-tx-report-queueclj

(remove-tx-report-queue conn queue)

Detach the shared tx report queue from conn.

Detach the shared tx report queue from `conn`.
raw docstring

seek-datomsclj

(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*)`
raw docstring

sinceclj

(since db-value tx-id)

Return a db value filtered since a tx-id.

Return a db value filtered since a tx-id.
raw docstring

touchclj

(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.
raw docstring

transactclj

(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.
raw docstring

tx-report-queueclj

(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`.
raw docstring

withclj

(with db tx-data)

Apply a transaction to a db value without persisting it.

Apply a transaction to a db value without persisting it.
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close