I have a datomic database that contains the following enum
{:db/id #db/id[:db.part/db]
:db/ident :demographics/gender
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db/doc "A person's gender enum reference"
:db.install/_attribute :db.part/db}
;; :demographics/gender enum values
{:db/id #db/id[:db.part/user]
:db/ident :demographics.gender/male}
{:db/id #db/id[:db.part/user]
:db/ident :demographics.gender/female}
{:db/id #db/id[:db.part/user]
:db/ident :demographics.gender/other}
Now say that I do:
(d/entity db ...)
And obtain a lazy map containing an entity and its attributes, the enum above included. I now want to obtain a string representation of the enum value that I get as a response from my query. My idea was to do this:
(def ^:private gender-map {:demographics.gender/male "Male"
:demographics.gender/female "Female"
:demographics.gender/other "Other"})
and then this
(gender-map (lazy-map :demographics/gender))
However, that did not work. What would be the correct way to do this?
Thanks
(d/entity db ...)result and I got the enum value as a string (e.g. "male"). Thegender-mapwas therefore unnecessary. - Litterate