Liking cljdoc? Tell your friends :D

net.favila.enhanced-entity-map

Enhanced Entity Maps.

Public interface:

  • entity: Make an entity map like d/entity but with special powers:

    • Can support metadata.
    • Can assoc values on to it.
    • Can compute and cache derived attributes. See entity-map-derived-attribute below.
    • Can do database reads using the :aevt index selectively.
  • as-enhanced-entity: Convert a d/entity to an enhanced entity map while preserving its cache. Note that unfortunately entity maps and enhanced entity maps do not compare equal using clojure.core/= because entity maps do an explicit class check.

  • prefer-aevt: Use AEVT index instead of EAVT index for enhanced-entity-map database reads done in its body.

  • prefer-eavt: Same, but prefers EAVT to AEVT. (This is the default, and what d/entity does.)

  • entity-map-derived-attribute: A multimethod which you can implement to make derived, computed attributes. The method accepts an enhanced entity map and an attribute (possibly reverse) and returns a computed value, which is then cached on the enhanced entity map.

  • entity-map?: Predicate to test for a normal or enhanced entity map.

Enhanced Entity Maps.

Public interface:

* entity: Make an entity map like d/entity but with special powers:
  * Can support metadata.
  * Can assoc values on to it.
  * Can compute and cache derived attributes. See entity-map-derived-attribute below.
  * Can do database reads using the :aevt index selectively.

* as-enhanced-entity: Convert a d/entity to an enhanced entity map
  while preserving its cache. Note that unfortunately entity maps and
  enhanced entity maps do not compare equal using clojure.core/= because
  entity maps do an explicit class check.

* prefer-aevt: Use AEVT index instead of EAVT index for enhanced-entity-map
  database reads done in its body.

* prefer-eavt: Same, but prefers EAVT to AEVT. (This is the default,
  and what d/entity does.)

* entity-map-derived-attribute: A multimethod which you can implement to make
  derived, computed attributes. The method accepts an enhanced entity map
  and an attribute (possibly reverse) and returns a computed value, which
  is then cached on the enhanced entity map.

* entity-map?: Predicate to test for a normal or enhanced entity map.
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close