(register-strategy f)
Registers a data storage stragey so that it can be used in an application.
The single argument is a function that will be called and given the configuration for the storage strategy. If the strategy is able to initialize itself with the given configuration, it returns the reified strategy. Otherwise it returns nil.
Registers a data storage stragey so that it can be used in an application. The single argument is a function that will be called and given the configuration for the storage strategy. If the strategy is able to initialize itself with the given configuration, it returns the reified strategy. Otherwise it returns nil.
(reify-storage config)
Searches registered strategies for one that is able to initialize itself with the given confiration.
If the given configuration implements Storage, it is returned. This allows a method that expects a storage configuration to receive a reified storage strategy also.
Searches registered strategies for one that is able to initialize itself with the given confiration. If the given configuration implements Storage, it is returned. This allows a method that expects a storage configuration to receive a reified storage strategy also.
This protocol defines the abstract CRUD operations to be used by the application. This abstraction can be implemented by whatever specific storage you want to use.
This protocol defines the abstract CRUD operations to be used by the application. This abstraction can be implemented by whatever specific storage you want to use.
(create this model)
Creates a new model record
Creates a new model record
(delete this model)
Deletes the specified model record
Deletes the specified model record
(delete-by this criteria)
Delete all models matching the specified criteria
Delete all models matching the specified criteria
(select this criteria options)
Selects model records matching the specified criteria
Selects model records matching the specified criteria
(update this model)
(update this attr criteria)
Given two args, updates the specified model. Given three arguments, applies the specified attributes to records matching the specified criteria.
Given two args, updates the specified model. Given three arguments, applies the specified attributes to records matching the specified criteria.
(with-transaction this func)
Executes the specified function which expects a single argument, which is a transacted storage instance
Executes the specified function which expects a single argument, which is a transacted storage instance
(tag model)
(tag model model-type)
Given two arguments returns the first argument (the model) with updated metadata that can be used to determine how the model should be stored.
Given one argument, returns the type identifier from the metadata.
If the model already has a tag, and that tag is different that the second argument, a warning is written to the log.
Given two arguments returns the first argument (the model) with updated metadata that can be used to determine how the model should be stored. Given one argument, returns the type identifier from the metadata. If the model already has a tag, and that tag is different that the second argument, a warning is written to the log.
(tagged? model model-type)
Returns true if the specified model is tagged with the specified value.
Returns true if the specified model is tagged with the specified value.
(with-storage binding & body)
Binds a reified storage strategy to the specified var.
(with-storage [stg config] (storage/update stg my-model))
Binds a reified storage strategy to the specified var. (with-storage [stg config] (storage/update stg my-model))
(with-transacted-storage binding & body)
Evaluates the body in the context of a transaction using the configured storage mechanism. (transacted-storage [trns config] (storage/update trns my-first-model) (storage/update trns my-other-model)))
Evaluates the body in the context of a transaction using the configured storage mechanism. (transacted-storage [trns config] (storage/update trns my-first-model) (storage/update trns my-other-model)))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close