(assoc-at tx path val-or-map)
Associates a path with a value or object, overwriting the current value (and all nested values)
The values will be changed in the datastore when the transaction is committed
(occurs after the body
of a with-write-transaction
form).
All paths will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Associates a path with a value or object, overwriting the current value (and all nested values) The values will be changed in the datastore when the transaction is committed (occurs after the `body` of a `with-write-transaction` form). All paths will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(assoc-at! db path val-or-map)
Wraps an assoc-at
call in a write transaction for convenience.
Returns the result at the provided path.
See (doc codax.core/assoc-at)
Wraps an `assoc-at` call in a write transaction for convenience. Returns the result at the provided path. See (doc codax.core/assoc-at)
(check-path-encoding value)
encodes and decodes the provided value
and returns a map of debugging info:
:equal - indicates if the decoded value is equal to the initial value :initial - the supplied value before encoding :decoded - the value after it has been decoded :encoded - the encoded (string) representation of the value
encodes and decodes the provided `value` and returns a map of debugging info: :equal - indicates if the decoded value is equal to the initial value :initial - the supplied value before encoding :decoded - the value after it has been decoded :encoded - the encoded (string) representation of the value
(close-all-databases!)
Safely closes all open databases
Safely closes all open databases
(close-database filepath-or-db)
DEPRECATED - use close-database!
instead
DEPRECATED - use `close-database!` instead
(close-database! filepath-or-db)
Safely closes the database at the provided filepath (or the filepath of the a database map) Attempts to use a closed or invalidated database will throw an Exception.
Safely closes the database at the provided filepath (or the filepath of the a database map) Attempts to use a closed or invalidated database will throw an Exception.
(defpathtype [hex-code & types] encoder decoder)
defines an encoder
and decoder
for values of the given types
hex-code
- a numeric code to identify the type
0x0 is used internally and is forbidden
types
- the types to be encoded (generally there should only be one)
encoder
- a function which takes elements of the types specified in types
and
returns a string representation
decoder
- a function which takes the string reprensentations generated by the
encoder and reconstructs a value of the appropriate type
Note: do not overwrite existing hex-code and type assignments.
to get lists of types and hex-codes in use call path-encoding-assignments
defines an `encoder` and `decoder` for values of the given `types` `hex-code` - a numeric code to identify the type 0x0 is used internally and is forbidden `types` - the types to be encoded (generally there should only be one) `encoder` - a function which takes elements of the types specified in `types` and returns a string representation `decoder` - a function which takes the string reprensentations generated by the encoder and reconstructs a value of the appropriate type Note: do not overwrite existing hex-code and type assignments. to get lists of types and hex-codes in use call `path-encoding-assignments`
(destroy-database! filepath-or-db)
Removes database files and generic archive files. If there is nothing else in the database directory, it is also removed. If open, the database will be closed.
This function is predominantly intended to facilitate testing.
Removes database files and generic archive files. If there is nothing else in the database directory, it is also removed. If open, the database will be closed. This function is predominantly intended to facilitate testing.
(dissoc-at tx path)
Deletes all values at the supplied path.
The value will be deleted from the datastore when the transaction is committed, (which
(occurs after the body
of a with-write-transaction
form).
The path will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Deletes all values at the supplied path. The value will be deleted from the datastore when the transaction is committed, (which (occurs after the `body` of a `with-write-transaction` form). The path will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(dissoc-at! db path)
Wraps a dissoc-at
call in a write transaction for convenience.
Returns the result at the provided path.
See (doc codax.core/dissoc-at)
Wraps a `dissoc-at` call in a write transaction for convenience. Returns the result at the provided path. See (doc codax.core/dissoc-at)
(get-at tx)
(get-at tx path)
Returns the map or other value at the supplied path
. If it has been modified within
the current transaction, it will evaluate to the modified value
path
will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Returns the map or other value at the supplied `path`. If it has been modified within the current transaction, it will evaluate to the modified value `path` will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(get-at! db)
(get-at! db path)
Wraps a get-at
call in a read transaction for convenience.
Returns the result at the provided path.
Warning: Will load and return the entire database if no path argument is supplied.
See (doc codax.core/get-at)
Wraps a `get-at` call in a read transaction for convenience. Returns the result at the provided path. Warning: Will load and return the entire database if no path argument is supplied. See (doc codax.core/get-at)
(is-open? filepath-or-db)
Takes a database or a path and returns true if the database is open. If the database is closed (or does not exist) false is returned.
Takes a database or a path and returns true if the database is open. If the database is closed (or does not exist) false is returned.
(merge-at! db path m)
Wraps a merge-at
call in a write transaction for convenience.
Returns the result at the provided path.
See (doc codax.core/merge-at)
Wraps a `merge-at` call in a write transaction for convenience. Returns the result at the provided path. See (doc codax.core/merge-at)
(open-database filepath & {:keys [backup-fn]})
DEPRECATED - use open-database!
instead
DEPRECATED - use `open-database!` instead
(open-database! filepath & {:keys [backup-fn]})
Opens a database at the given filepath. If a database is already open at the given path the existing database connection is returned.
By default a set of files in the database directory with the suffix ARCHIVE are created or overwritten on each compaction and represent the most recent pre-compaction state.
Alteratively, timestamped archives will be created if a :backup-fn
argument is supplied.
Once the timestamped archive-files are created, the :backup-fn
function will be called
(in a future) with a map containing the following keys:
:dir ; a string representing the full path to the database directory :suffix ; a string of the timestamp suffix attached to the files :file-names ; a vector of strings representing the generated file names
(see codax.backup/make-backup-archiver)
Opens a database at the given filepath. If a database is already open at the given path the existing database connection is returned. By default a set of files in the database directory with the suffix ARCHIVE are created or overwritten on each compaction and represent the most recent pre-compaction state. Alteratively, timestamped archives will be created if a `:backup-fn` argument is supplied. Once the timestamped archive-files are created, the `:backup-fn` function will be called (in a future) with a map containing the following keys: :dir ; a string representing the full path to the database directory :suffix ; a string of the timestamp suffix attached to the files :file-names ; a vector of strings representing the generated file names (see codax.backup/make-backup-archiver)
(path-encoding-assignments)
fetches a map of types and the string representation of hex-codes presently assigned to encoders and decoders
fetches a map of types and the string representation of hex-codes presently assigned to encoders and decoders
(seek-at tx path & {:keys [limit reverse]})
Provides key-value pairs ordered by key of the map at the provided path
.
path
will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Provides key-value pairs ordered by key of the map at the provided `path`. `path` will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(seek-at! db path & {:keys [limit reverse]})
Wraps a seek-at
call in a read transaction for convenience.
Wraps a `seek-at` call in a read transaction for convenience.
(seek-from tx path start-val & {:keys [limit reverse]})
Provides key-value pairs ordered by key of the map at the provided path
for all keys >= start-val
.
path
will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Provides key-value pairs ordered by key of the map at the provided `path` for all keys >= `start-val`. `path` will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(seek-from! db path start-val & {:keys [limit reverse]})
Wraps a seek-from
call in a read transaction for convenience.
Wraps a `seek-from` call in a read transaction for convenience.
(seek-prefix tx path val-prefix & {:keys [limit reverse]})
Provides key-value pairs ordered by key of the map at the provided path
for all keys beginning with val-prefix
.
Note: val-prefix
should be a string or keyword.
path
will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Provides key-value pairs ordered by key of the map at the provided `path` for all keys beginning with `val-prefix`. Note: `val-prefix` should be a string or keyword. `path` will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(seek-prefix! db path val-prefix & {:keys [limit reverse]})
Wraps a seek-prefix
call in a read transaction for convenience.
Wraps a `seek-prefix` call in a read transaction for convenience.
(seek-prefix-range tx path start-prefix end-prefix & {:keys [limit reverse]})
Provides key-value pairs ordered by key of the map at the provided path
for all keys beginning with a prefix between start-prefix
& end-prefix
Note: start-prefix
& end-prefix
should be strings or keywords.
path
will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Provides key-value pairs ordered by key of the map at the provided `path` for all keys beginning with a prefix between `start-prefix` & `end-prefix` Note: `start-prefix` & `end-prefix` should be strings or keywords. `path` will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(seek-prefix-range! db path start-prefix end-prefix & {:keys [limit reverse]})
Wraps a seek-prefix-range
call in a read transaction for convenience.
Wraps a `seek-prefix-range` call in a read transaction for convenience.
(seek-range tx path start-val end-val & {:keys [limit reverse]})
Provides key-value pairs ordered by key of the map at the provided path
for all keys >= start-val
and <= end-val
.
path
will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Provides key-value pairs ordered by key of the map at the provided `path` for all keys >= `start-val` and <= `end-val`. `path` will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(seek-range! db path start-val end-val & {:keys [limit reverse]})
Wraps a seek-range
call in a read transaction for convenience.
Wraps a `seek-range` call in a read transaction for convenience.
(seek-to tx path end-val & {:keys [limit reverse]})
Provides key-value pairs ordered by key of the map at the provided path
for all keys <= end-val
.
path
will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Provides key-value pairs ordered by key of the map at the provided `path` for all keys <= `end-val`. `path` will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(seek-to! db path end-val & {:keys [limit reverse]})
Wraps a seek-to
call in a read transaction for convenience.
Wraps a `seek-to` call in a read transaction for convenience.
(update-at tx path f & args)
Runs a function on the current map or value at the supplied path and assoc-at
s the result.
The values will be changed in the datastore when the transaction is committed
(occurs after the body
of a with-write-transaction
form).
All paths will be prefixed with the transaction prefix
(if the transaction has one,
by default, it does not).
Runs a function on the current map or value at the supplied path and `assoc-at`s the result. The values will be changed in the datastore when the transaction is committed (occurs after the `body` of a `with-write-transaction` form). All paths will be prefixed with the transaction `prefix` (if the transaction has one, by default, it does not).
(update-at! db path f & args)
Wraps an update-at
call in a write transaction for convenience.
Returns the result at the provided path.
See (doc codax.core/update-at)
Wraps an `update-at` call in a write transaction for convenience. Returns the result at the provided path. See (doc codax.core/update-at)
(with-read-transaction [database tx-symbol & {:keys [prefix]}] & body)
Creates a read transaction object and assigns it to tx-symbol
.
This transaction object can be passed to the non-modifying transaction functions.
Behavior when passed to a modifying transaction function is undefined.
The final value will be the result of evaluating the body
.
Creates a read transaction object and assigns it to `tx-symbol`. This transaction object can be passed to the non-modifying transaction functions. Behavior when passed to a modifying transaction function is undefined. The final value will be the result of evaluating the `body`.
(with-write-transaction [database tx-symbol & {:keys [prefix]}] & body)
Creates a write transaction object and assigns it to the tx-symbol
.
This transaction object can be passed to any of the transaction functions.
The body
must evaluate to this object so it can be committed.
Creates a write transaction object and assigns it to the `tx-symbol`. This transaction object can be passed to any of the transaction functions. The `body` must evaluate to this object so it can be committed.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close