(def-entity-macros & syms)
Creates an entity-generating macro for each symbol in syms, where symbol refers to a function that takes an entity id as its first argument and any number of arguments for the entity's properties. This includes any function created via def-entity-props and functions created via def-entity-maps with the :id option set.
For example (def-entity-macros widget) creates a macro like
(defmacro defwidget [id & body] `(def ~id (widget ~(name id) ~@body)))
Creates an entity-generating macro for each symbol in syms, where symbol refers to a function that takes an entity id as its first argument and any number of arguments for the entity's properties. This includes any function created via def-entity-props and functions created via def-entity-maps with the :id option set. For example (def-entity-macros widget) creates a macro like (defmacro defwidget [id & body] `(def ~id (widget ~(name id) ~@body)))
(def-entity-maps opt & syms)
Creates functions for creating maps representing an entity. The macro accepts one or more symbols possibly preceded by an options map. See def-entity-props for details
Example: (def-entity-maps {:tag 1 :id :id} person)
(person :fred :age 4 :dob 2001) => {:tag :person :id :fred :age 4 :dob 2001}
Creates functions for creating maps representing an entity. The macro accepts one or more symbols possibly preceded by an options map. See def-entity-props for details Example: (def-entity-maps {:tag 1 :id :id} person) (person :fred :age 4 :dob 2001) => {:tag :person :id :fred :age 4 :dob 2001}
(def-entity-props opt & syms)
Accepts one or more symbols possibly preceded by an options map. For each symbol, creates a function that returns an Entity Property. The first argument to each generated function is the Entity name. All remaining arguments describe the Entity's properties. If the :tag option is truthy, generated maps will have a :tag key whose value matches the function name. If :id is supplied, its value will be used as an ID key in generated maps.
Example: (def-entity-props ent1 ent2) (def-entity-props {:tag true} ent3 ent4) (def-entity-props {:id :name} ent5 ent6) (def-entity-props {:id :id, :tag :truthy} ent7)
(ent1 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001}} (ent3 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001 :tag :ent3}} (ent5 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001 :name :fred}} (ent7 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001 :id :fred :tag :ent7}}
Accepts one or more symbols possibly preceded by an options map. For each symbol, creates a function that returns an Entity Property. The first argument to each generated function is the Entity name. All remaining arguments describe the Entity's properties. If the :tag option is truthy, generated maps will have a :tag key whose value matches the function name. If :id is supplied, its value will be used as an ID key in generated maps. Example: (def-entity-props ent1 ent2) (def-entity-props {:tag true} ent3 ent4) (def-entity-props {:id :name} ent5 ent6) (def-entity-props {:id :id, :tag :truthy} ent7) (ent1 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001}} (ent3 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001 :tag :ent3}} (ent5 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001 :name :fred}} (ent7 :fred :age 4 :dob 2001) => {:fred {:age 4 :dob 2001 :id :fred :tag :ent7}}
(edit m & args)
Edits an existing map, m, using mk-map*. See mk-map* for how the arguments are processed
Edits an existing map, m, using mk-map*. See mk-map* for how the arguments are processed
(mk-map & args)
Makes a new map using mk-map*. See mk-map* for how the arguments are processed
Makes a new map using mk-map*. See mk-map* for how the arguments are processed
(mk-map* m args)
Process args recursively to edit an existing map, m. Arguments are processed as follows:
See [[diesel.core-test]] for examples.
Process args recursively to edit an existing map, m. Arguments are processed as follows: - If args is empty return the current map. - If arg is nil, skip it. This lets you use forms like if and when to conditionally edit a map. - If arg is a map, merge it into the current map - If arg is a collection, splice it into args and continue. This lets you use for comprehensions and such in calls to mk-map* - If arg is a function, apply it to the current map. - Otherwise, assume arg forms a key/value pair with the next arg. If the value part is a function, apply it to the current value and assoc the result to the existing key. Else, just assoc the new value to the given key. Both ways consume two arguments. It's an error if value is missing. See [[diesel.core-test]] for examples.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close