(delete
{database :database {:keys [history-collection]} :entity :as model-component}
record-id)
Deletes the current version of the specified record from the history. This is meant to be used to clean up history after a failed update, as otherwise the latest version of a record would be in the history.
Returns:
Deletes the current version of the specified record from the history. This is meant to be used to clean up history after a failed update, as otherwise the latest version of a record would be in the history. Returns: - the number of records deleted
(find-all-by-record-id
{database :database {:keys [history-collection]} :entity :as model-component}
id)
Returns the history of the specified record.
Returns the history of the specified record.
(find-latest-matching-record-at
{database :database {:keys [history-collection]} :entity :as model-component}
id
datetime
conditions)
Returns:
datetime
the latest version of the record specified by
id
that matched the specified conditions
, orReturns: - what was at `datetime` the latest version of the record specified by `id` that matched the specified `conditions`, or - nil if a record with the given id is not found anywhere, including history (i.e. if the record has never existed)
(find-record-at model-component id datetime)
Returns:
Returns: - the specified record as it was at the specified time, or - a map with a :deleted_at key if the record was deleted by the specified time, or - nil if a record with the given id is not found anywhere, including history (i.e. if the record has never existed)
(save
{database :database {:keys [history-collection]} :entity :as model-component}
record-id)
Saves the specified record in the history.
Returns:
Saves the specified record in the history. Returns: - [false nil] if the record was not found - [false {:base [:insert-error]}] if insertion into the database fails - [true created-history-record] otherwise
(save-delete
{database :database {:keys [history-collection]} :entity :as model-component}
record-id)
Saves the delete of the specified record in the history.
Two history records are created, one stores the record that is going to be deleted, with the original :created_at and :updated_at values, the other essentially stores the time of the deletion in a :deleted_at field.
Returns:
Saves the delete of the specified record in the history. Two history records are created, one stores the record that is going to be deleted, with the original :created_at and :updated_at values, the other essentially stores the time of the deletion in a :deleted_at field. Returns: - [false nil] if the record was not found - [false {:base [:insert-error]}] if insertion into the database fails - [true saved-record] otherwise
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close