merkle-db.database

Core database functions.

create-table

(create-table db table-name attrs)

Create a new table with the given name and optional attributes to merge into the root node data. Returns an updated database value, or throws an exception if the table already exists.

IDatabase

protocol

Protocol for interacting with a database at a specific version.

members

drop-table

(drop-table db table-name)

Remove the named table from the database. Returns an updated database value.

flush!

(flush! db)

Ensure any pending changes are persistently stored. Returns an updated database value.

get-table

(get-table db table-name)

Return a value representing the named table in the database, or nil if no such table exists.

list-tables

(list-tables db)(list-tables db opts)

Return a sequence of maps with partial information about the tables in the database, including their name and total size.

Options may include:

  • :named If set to a string, return tables whose names are prefixed by the value. This may also be a regular expression to match table names against.
  • :offset Skip this many matching results.
  • :limit Return at most this many results.

set-table

(set-table db table-name value)

Set the state of the named table. Returns an updated database value.

rename-table

(rename-table db from to)

Update the database by moving the table named from to the name to. Returns an updated database value, or throws an exception if table from does not exist or to already exists.

update-table

(update-table db table-name f & args)

Update the table by calling f with the current table value and the remaining args. Returns an updated database value, or throws an exception if the table does not exist.