(conforms-to? db norm tx-count)
(conforms-to? db conformity-attr norm tx-count)
Does database have a norm installed?
conformity-attr (optional) the keyword name of the attribute used to track conformity norm the keyword name of the norm you want to check tx-count the count of transactions for that norm
Does database have a norm installed? conformity-attr (optional) the keyword name of the attribute used to track conformity norm the keyword name of the norm you want to check tx-count the count of transactions for that norm
(default-conformity-attribute-for-db db)
Returns the default-conformity-attribute for a db.
Returns the default-conformity-attribute for a db.
(ensure-conformity-schema conn conformity-attr)
(ensure-conformity-schema conn conformity-attr tx-instant)
Ensure that the two attributes and one transaction function required to track conformity via the conformity-attr keyword parameter are installed in the database.
Ensure that the two attributes and one transaction function required to track conformity via the conformity-attr keyword parameter are installed in the database.
(ensure-conforms conn norm-map)
(ensure-conforms conn norm-map norm-names)
(ensure-conforms conn conformity-attr norm-map norm-names)
(ensure-conforms conn conformity-attr norm-map norm-names tx-instant)
Ensure that norms represented as datoms are conformed-to (installed), be they schema, data or otherwise.
conformity-attr (optional) the keyword name of the attribute used to
track conformity
norm-map a map from norm names to data maps.
a data map contains:
:txes - the data to install
:txes-fn - An alternative to txes, pointing to a
symbol representing a fn on the classpath that
will return transactions.
:requires - (optional) a list of prerequisite norms
in norm-map.
:first-time-only - (optional) a boolean. If true, a norm will be
conformed only once. After that norm-name will
be permanently ignored. Any norm with same norm-name,
be it modification of the old one or new norm
named the same will not even be considered to conformed
as soon as the name reuse is detected.
norm-names (optional) A collection of names of norms to conform to.
Will use keys of norm-map if not provided.
On success, returns a vector of maps with values for :norm-name, :tx-index, and :tx-result for each transaction that improved the db's conformity.
On failure, throws an ex-info with a reason and data about any partial success before the failure.
Ensure that norms represented as datoms are conformed-to (installed), be they schema, data or otherwise. conformity-attr (optional) the keyword name of the attribute used to track conformity norm-map a map from norm names to data maps. a data map contains: :txes - the data to install :txes-fn - An alternative to txes, pointing to a symbol representing a fn on the classpath that will return transactions. :requires - (optional) a list of prerequisite norms in norm-map. :first-time-only - (optional) a boolean. If true, a norm will be conformed only once. After that norm-name will be permanently ignored. Any norm with same norm-name, be it modification of the old one or new norm named the same will not even be considered to conformed as soon as the name reuse is detected. norm-names (optional) A collection of names of norms to conform to. Will use keys of norm-map if not provided. On success, returns a vector of maps with values for :norm-name, :tx-index, and :tx-result for each transaction that improved the db's conformity. On failure, throws an ex-info with a reason and data about any partial success before the failure.
Transaction function to ensure each norm tx is executed exactly once
Transaction function to ensure each norm tx is executed exactly once
(eval-txes-fn conn txes-fn)
Given a connection and a symbol referencing a function on the classpath...
require
the symbol's namespaceresolve
the symbolGiven a connection and a symbol referencing a function on the classpath... - `require` the symbol's namespace - `resolve` the symbol - evaluate the function, passing it the connection - return the result
(first-time-only-conforms-to? db norm)
(first-time-only-conforms-to? db conformity-attr norm)
If a norm is supposed to be first-time-only/not-changeable then the decision whether a norm should be conformed is absence of norm name in conformed norms registry.
Does database have an unchangeable norm installed?
conformity-attr (optional) the keyword name of the attribute used to
track conformity
norm the keyword name of the norm you want to check
If a norm is supposed to be first-time-only/not-changeable then the decision whether a norm should be conformed is absence of norm name in conformed norms registry. Does database have an unchangeable norm installed? conformity-attr (optional) the keyword name of the attribute used to track conformity norm the keyword name of the norm you want to check
(get-norm conn norm-map norm-name)
Pull from norm-map
the norm-name
value. If the norm contains a
txes-fn
key, allow processing of that key to stand in for a txes
value. Returns the value containing transactable data.
Pull from `norm-map` the `norm-name` value. If the norm contains a `txes-fn` key, allow processing of that key to stand in for a `txes` value. Returns the value containing transactable data.
(handle-first-time-only-norm acc
conn
norm-attr
norm-map
norm-name
sync-schema-timeout
tx-instant)
(handle-mutable-norm acc
conn
norm-attr
norm-map
norm-name
sync-schema-timeout
tx-instant)
(handle-txes acc
conn
norm-attr
norm-name
txes
ex
sync-schema-timeout
tx-instant)
If a collection of txes data to transact is empty then return:
Run transaction for each element of txes collection otherwise.
If a collection of txes data to transact is empty then return: 1. an info of what's been successfully transacted this far 2. a structure with info which norm failed and for what reason. Run transaction for each element of txes collection otherwise.
(has-attribute? db attr-name)
Returns true if a database has an attribute named attr-name
Returns true if a database has an attribute named attr-name
(has-function? db fn-name)
Returns true if a database has a function named fn-name
Returns true if a database has a function named fn-name
(index-attr conformity-attr)
Returns the index-attr corresponding to a conformity-attr
Returns the index-attr corresponding to a conformity-attr
(last-tx-instant db)
Returns a value of the :db/txInstant attribute of the last transaction.
Returns a value of the :db/txInstant attribute of the last transaction.
(read-resource resource-name)
(read-resource opts resource-name)
Reads and returns data from a resource containing edn text. An optional argument allows specifying opts for clojure.edn/read
Reads and returns data from a resource containing edn text. An optional argument allows specifying opts for clojure.edn/read
(reduce-norms acc conn norm-attr norm-map norm-names)
(reduce-norms acc conn norm-attr norm-map norm-names tx-instant)
Reduces norms from a norm-map specified by a seq of norm-names into a transaction result accumulator
Reduces norms from a norm-map specified by a seq of norm-names into a transaction result accumulator
(reduce-txes acc conn norm-attr norm-name txes sync-schema-timeout)
(reduce-txes acc conn norm-attr norm-name txes sync-schema-timeout tx-instant)
Reduces the seq of transactions for a norm into a transaction result accumulator
Reduces the seq of transactions for a norm into a transaction result accumulator
(with-conforms db norm-map)
(with-conforms db norm-map norm-names)
(with-conforms db conformity-attr norm-map norm-names)
Variation of ensure-conforms that speculatively ensures norm are conformed to
On success, returns a map with: :db the resulting database that conforms the the provided norms :result a vector of maps with values for :norm-name, :tx-index, and :tx-result for each transaction that improved the db's conformity.
On failure, throws an ex-info with a reason and data about any partial success before the failure.
Variation of ensure-conforms that speculatively ensures norm are conformed to On success, returns a map with: :db the resulting database that conforms the the provided norms :result a vector of maps with values for :norm-name, :tx-index, and :tx-result for each transaction that improved the db's conformity. On failure, throws an ex-info with a reason and data about any partial success before the failure.
(with-tx-instant instant tx-data)
If instant is not nil, add it as the :db/txInstant attribute of transaction.
If instant is not nil, add it as the :db/txInstant attribute of transaction.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close