Liking cljdoc? Tell your friends :D

merkle-db.table

Tables are collections of records which specify how the records are identified and stored. A table is presented as an immutable value; functions in this namespace return a new version of the table argument, keeping the original unchanged. Modifications are kept in memory until flush! is called.

Tables are collections of records which specify how the records are
identified and stored. A table is presented as an immutable value; functions
in this namespace return a new version of the table argument, keeping the
original unchanged. Modifications are kept in memory until `flush!` is
called.
raw docstring

deleteclj

(delete table ids)

Remove the identified records from the table. Returns an updated version of the table which does not contain records whose id was in the collection.

Remove the identified records from the table. Returns an updated version of
the table which does not contain records whose id was in the collection.
raw docstring

dirty?clj

(dirty? table)

True if the table has local non-persisted modifications.

True if the table has local non-persisted modifications.
raw docstring

flush!clj

(flush! table)
(flush! table opts)

Ensure that all local state has been persisted to the storage backend. Returns an updated persisted table.

Options may include:

  • :apply-patch? If true, any current patch data will be merged into the main data tree.
Ensure that all local state has been persisted to the storage backend.
Returns an updated persisted table.

Options may include:

- `:apply-patch?`
  If true, any current patch data will be merged into the main data tree.
raw docstring

insertclj

(insert table records)
(insert table records opts)

Insert a collection of records into the table. Returns an updated table value which includes the data.

Options may include:

  • :update-field A function which will be called with (f field-key old-val new-val), and should return the new value to use for that field. By default, new-val is used directly.
  • :update-record A function which will be called with (f record-key old-data new-data), and should return the data map to use for the record. By default, this merges the data maps and removes nil-valued fields.
Insert a collection of records into the table. Returns an updated table
value which includes the data.

Options may include:

- `:update-field`
  A function which will be called with `(f field-key old-val new-val)`, and
  should return the new value to use for that field. By default, `new-val`
  is used directly.
- `:update-record`
  A function which will be called with `(f record-key old-data new-data)`,
  and should return the data map to use for the record. By default, this
  merges the data maps and removes nil-valued fields.
raw docstring

keysclj

(keys table)
(keys table opts)

Scan the table, returning keys of the stored records which match the given options. Returns a lazy sequence of keys, or nil if the table is empty.

If min and max keys are given, only records within the bounds will be returned (inclusive). A nil min or max implies the beginning or end of the data, respectively.

Options may include:

  • :min-key Return records with keys equal to or greater than the marker.
  • :max-key Return records with keys equal to or less than the marker.
  • :reverse (NYI) Reverse the order the keys are returned in.
  • :offset Skip this many records in the output.
  • :limit Return at most this many records.
Scan the table, returning keys of the stored records which match the given
options. Returns a lazy sequence of keys, or nil if the table is empty.

If min and max keys are given, only records within the bounds will be
returned (inclusive). A nil min or max implies the beginning or end of
the data, respectively.

Options may include:

- `:min-key`
  Return records with keys equal to or greater than the marker.
- `:max-key`
  Return records with keys equal to or less than the marker.
- `:reverse` (NYI)
  Reverse the order the keys are returned in.
- `:offset`
  Skip this many records in the output.
- `:limit`
  Return at most this many records.
raw docstring

load-tableclj

(load-table store table-name target)

Load a table root node from the graph store.

Load a table root node from the graph store.
raw docstring

new-tableclj

(new-table store table-name opts)

Create a new table value backed by the given graph store. Any options given will be merged into the table root.

Create a new table value backed by the given graph store. Any options given
will be merged into the table root.
raw docstring

readclj

(read table ids)
(read table ids opts)

Read a set of records from the database, returning data for each present record. Returns a sequence of record data maps.

Options may include:

  • :fields Only return data for the selected set of fields. If provided, only records with data for one or more of the fields are returned, otherwise all fields and records are returned.
Read a set of records from the database, returning data for each present
record. Returns a sequence of record data maps.

Options may include:

- `:fields`
  Only return data for the selected set of fields. If provided, only
  records with data for one or more of the fields are returned, otherwise
  all fields and records are returned.
raw docstring

scanclj

(scan table)
(scan table opts)

Scan the table, returning data from records which match the given options. Returns a lazy sequence of record data maps, sorted by key.

If min and max keys or indices are given, only records within the bounds will be returned (inclusive). A nil min or max implies the beginning or end of the data, respectively.

Options may include:

  • :fields Only return data for the selected set of fields. If provided, only records with data for one or more of the fields are returned, otherwise all fields and records (including empty ones) are returned.
  • :min-key Return records with keys equal to or greater than the marker.
  • :max-key Return records with keys equal to or less than the marker.
  • :reverse (NYI) Reverse the order the keys are returned in.
  • :offset Skip this many records in the output.
  • :limit Return at most this many records.
Scan the table, returning data from records which match the given options.
Returns a lazy sequence of record data maps, sorted by key.

If min and max keys or indices are given, only records within the
bounds will be returned (inclusive). A nil min or max implies the beginning
or end of the data, respectively.

Options may include:

- `:fields`
  Only return data for the selected set of fields. If provided, only
  records with data for one or more of the fields are returned, otherwise
  all fields and records (including empty ones) are returned.
- `:min-key`
  Return records with keys equal to or greater than the marker.
- `:max-key`
  Return records with keys equal to or less than the marker.
- `:reverse` (NYI)
  Reverse the order the keys are returned in.
- `:offset`
  Skip this many records in the output.
- `:limit`
  Return at most this many records.
raw docstring

set-backingclj

(set-backing table store table-name)

Change the backing store and info for a table.

Change the backing store and info for a table.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close