(complement-migration conn migration)
If migration contains tx-data, function returns migration unchanged. If it contains tx-data-fn instead then it evaluates resolved symbol and merges the result with migration.
If migration contains tx-data, function returns migration unchanged. If it contains tx-data-fn instead then it evaluates resolved symbol and merges the result with migration.
(ensure-installed conn migration)
Ensure that migration is installed, be it schema, data or otherwise. A migration is represented in a format of a map with kv pairs:
:id - unique identifier of the migration. The id needs to be of type clojure.lang.Keyword.
No migrations having same id will get installed after this one has been installed.
:tx-data - a vector of datoms to be transacted if migration is not installed yet.
:tx-data-fn - an alternative to :tx-data
.
It's a symbol representing a function that will be ran to produce tx-data.
The function will be ran with one argument - conn.
If migration hasn't been installed before then function will return with a transaction result.
It will return ::already-installed
otherwise.
Ensure that migration is installed, be it schema, data or otherwise. A migration is represented in a format of a map with kv pairs: :id - unique identifier of the migration. The id needs to be of type clojure.lang.Keyword. No migrations having same id will get installed after this one has been installed. :tx-data - a vector of datoms to be transacted if migration is not installed yet. :tx-data-fn - an alternative to `:tx-data`. It's a symbol representing a function that will be ran to produce tx-data. The function will be ran with one argument - conn. If migration hasn't been installed before then function will return with a transaction result. It will return `::already-installed` otherwise.
Transaction function to ensure that each migration is executed exactly only when a migration-id isn't known to had been installed in past.
Transaction function to ensure that each migration is executed exactly only when a migration-id isn't known to had been installed in past.
Ident for a function installed in datomic.
See ensure-migration-should-be-installed
Ident for a function installed in datomic. See `ensure-migration-should-be-installed`
(ensure-stork-schema conn)
Makes sure that library vitals are installed into the db:
:stork/ensure-migration-should-be-installed-txfn
)Makes sure that library vitals are installed into the db: 1) An attribute to store information about successfully installed migrations. 2) A custom datomic function for safe migration installing (see `:stork/ensure-migration-should-be-installed-txfn`)
(eval-tx-data-fn conn tx-data-fn)
Tries to resolve the symbol that contains the function. It's evaluation should result in a valid tx-data.
Tries to resolve the symbol that contains the function. It's evaluation should result in a valid tx-data.
(handle-migration conn {:keys [id] :as migration})
Checks if a migration's id is known to be installed already. If it is, return ::already-installed. Otherwise transact tx-data (be it explicitly given or evaluated from tx-data-fn) and return transaction's result.
Checks if a migration's id is known to be installed already. If it is, return ::already-installed. Otherwise transact tx-data (be it explicitly given or evaluated from tx-data-fn) and return transaction's result.
(handle-tx-data conn migration-id tx-data sync-schema-timeout)
Tries to transact tx-data using custom :stork/:stork/ensure-migration-should-be-installed.
Tries to transact tx-data using custom :stork/:stork/ensure-migration-should-be-installed.
(has-attribute? db attr-name)
Checks if an attribute is installed into db schema.
Checks if an attribute is installed into db schema.
(has-function? db fn-name)
Checks if an entity (queried by ident) has a function installed.
Checks if an entity (queried by ident) has a function installed.
(installed? db migration-id)
Checks if a migration-id is known to be already installed into the db.
Checks if a migration-id is known to be already installed into the db.
(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
(tx-data-xor-tx-data-fn? {:keys [tx-data tx-data-fn]})
Returns true if: a) tx-data is present and tx-data-fn is not b) tx-data-fn is present and tx-data is not Returns false otherwise.
Returns true if: a) tx-data is present and tx-data-fn is not b) tx-data-fn is present and tx-data is not Returns false otherwise.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close