theophilusx.yorick.store
Provides convenience functions for manipulating maps stored as Reagent atoms.
assoc-in!
(assoc-in! state ks v)Associates a value in the session, where ks is a sequence of keys and v is the new value and returns a new nested structure. If any levels do not exist, hash-maps will be created.
clear!
(clear! state)Remove all data from the session and start over cleanly.
cursor
(cursor state ks)Returns a cursor from the state atom. state is the reagent atom while ks are the keys (path) into the atom.
get
(get state k & [default])Get the key’s value from the session, returns nil if it doesn’t exist.
get!
(get! state k & [default])Destructive get from the session. This returns the current value of the key and then removes it from the session.
get-in
(get-in state ks & [default])Gets the value at the path specified by the vector ks from the session, returns nil if it doesn’t exist.
get-in!
(get-in! state ks & [default])Destructive get from the session. This returns the current value of the path specified by the vector ks and then removes it from the session.
global-state
put!
(put! state k v)Set the key k in the atom state to value v.
remove!
(remove! state k)Remove a key from the session
reset!
(reset! state m)Reset the state of the atom state to the value m.
swap!
(swap! state f & args)Replace the current session’s value with the result of executing f with the current value and args.
update!
(update! state k f & args)Updates a value in session where k is a key and f is the function that takes the old value along with any supplied args and return the new value. If key is not present it will be added.
update-in!
(update-in! state ks f & args)Updates a value in the session, where ks is a sequence of keys and f is a function that will take the old value along with any supplied args and return the new value. If any levels do not exist, hash-maps will be created.