A Mongoid-like library that lets you focus on the important stuff
A Mongoid-like library that lets you focus on the important stuff
(add-functions ns function-defs model-hooks fn-middleware metrics-fn)
Takes a list of hashes which define functions, wraps those functions according to their specification, and interns those functions in the target namespace
Takes a list of hashes which define functions, wraps those functions according to their specification, and interns those functions in the target namespace
(canonicalize-field-defs {:keys [name required findable default validators
keyword transient]
:as args})
Validate field definitions
Validate field definitions
(col-validators fields)
Returns a vector of validators from field definitions
Returns a vector of validators from field definitions
(convert-dotmap-to-nested m)
Converts a map with dot-notated keys to a nested map
Converts a map with dot-notated keys to a nested map
(create-col-function collection
field
defaults
transients
use-refs
keywords
strings
profile-reads
profile-writes)
(create-row-functions collection
row-validators
field-defs
defaults
transients
use-refs
keywords
strings
profile-reads
profile-writes)
(deep-merge-with-like-mongo old_map new_map strings)
Merge new fields into an old map the same way MongoDB does. Note that although this plays nicely with dot-notated nested fields it does not play nicely with indexes at the moment
Merge new fields into an old map the same way MongoDB does. Note that although this plays nicely with dot-notated nested fields it does not play nicely with indexes at the moment
(defmodel collection
&
{:keys [validators fields use-refs profile-reads profile-writes hooks
fn-middleware metrics-fn]
:or {validators [] fields [] use-refs false hooks {}}
:as attrs})
Define a DB model from its fields
Define a DB model from its fields
(dot-keyword-to-unnested-vector k)
Takes a dot-notated keyword and splits it into a vector of keywords
Takes a dot-notated keyword and splits it into a vector of keywords
(extract-congo-argument args key)
Given an argument list, extract the keyword argument named 'key'
Given an argument list, extract the keyword argument named 'key'
(intern-fn fn {:keys [ns name doc arglists]})
intern the function in :ns under the name :name
intern the function in :ns under the name :name
(is-dot-notated? k)
Checks if a keyword is in dot-notation
Checks if a keyword is in dot-notation
(some-hooks hooks)
Takes a seq of hooks and returns a function that is the composition of those hooks. Adds a nil-guard to each of the hooks, stops executing hooks if passed nil or when a hook in the chain returns nil. Returns nil if called with nil or if any of the hooks returns nil.
Takes a seq of hooks and returns a function that is the composition of those hooks. Adds a nil-guard to each of the hooks, stops executing hooks if passed nil or when a hook in the chain returns nil. Returns nil if called with nil or if any of the hooks returns nil.
(wrap-debug f)
Wrap f to add default output values for the result of f
Wrap f to add default output values for the result of f
(wrap-input-defaults f defaults)
Wrap f to add default output values for the result of f
Wrap f to add default output values for the result of f
(wrap-output-defaults f defaults)
Wrap f to add default output values for the result of f
Wrap f to add default output values for the result of f
(wrap-output-incomplete? f)
Wrap f to add metadata about whether the returned document is incomplete
Wrap f to add metadata about whether the returned document is incomplete
(wrap-refs f input? output?)
If input? and output?, replace the first argument's value with the result. If just input?, deref the only argument. If just output?, wrap a ref around the result. Otherwise, just run normally
If input? and output?, replace the first argument's value with the result. If just input?, deref the only argument. If just output?, wrap a ref around the result. Otherwise, just run normally
(wrap-transients f transients)
Take the last arguent and strips the transient attributes from it. Apply the DB operation, and then readdd the transient attributes to its result
Take the last arguent and strips the transient attributes from it. Apply the DB operation, and then readdd the transient attributes to its result
(wrap-translations f options)
If the result of f contains keys which are in keywords, convert them to keywords
If the result of f contains keys which are in keywords, convert them to keywords
(wrap-validate f validators)
If validators is true, run validate!
If validators is true, run validate!
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close