Guillermo Winkler
2014-12-03 17:36:26 UTC
Ok, already answered here
https://groups.google.com/forum/#!topic/datomic/hnWqKmbNAhE
https://groups.google.com/forum/#!topic/datomic/hnWqKmbNAhE
Hi, Iâm having some doubts regarding the results projected by the pull API when the schema has an enum value.
{:db/ident :post/status
:db/id #db/id [:db.part/db]
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
;;statuses
[:db/add #db/id[:db.part/user] :db/ident :status/draft]
[:db/add #db/id[:db.part/user] :db/ident :status/published]
When pulling all attributes are requested
(d/pull db [:*] 17592186045522)
Post status is projected as a datomic entity, and not as the keyword for the âenum value".
:post/status {:db/id 17592186045453}
If I request specifically the enumerated value as a reference.
(d/pull db [:*
{:post/status [:db/ident]
...}] 17592186045522)
The post/status field is properly solved.
:post/status {:db/ident :status/draft},
This doesnât seem to be consistent with the results returned when using the d/entity API call
(:post/status (d/entity db 17592186045522))
=> :status/draft
There is a way to achieve consistency when using the pull api for âenum likeâ references?
With the current situation we need to have special consideration with the projected results if coming from one API or another.
Thanks
Guille
{:db/ident :post/status
:db/id #db/id [:db.part/db]
:db/valueType :db.type/ref
:db/cardinality :db.cardinality/one
:db.install/_attribute :db.part/db}
;;statuses
[:db/add #db/id[:db.part/user] :db/ident :status/draft]
[:db/add #db/id[:db.part/user] :db/ident :status/published]
When pulling all attributes are requested
(d/pull db [:*] 17592186045522)
Post status is projected as a datomic entity, and not as the keyword for the âenum value".
:post/status {:db/id 17592186045453}
If I request specifically the enumerated value as a reference.
(d/pull db [:*
{:post/status [:db/ident]
...}] 17592186045522)
The post/status field is properly solved.
:post/status {:db/ident :status/draft},
This doesnât seem to be consistent with the results returned when using the d/entity API call
(:post/status (d/entity db 17592186045522))
=> :status/draft
There is a way to achieve consistency when using the pull api for âenum likeâ references?
With the current situation we need to have special consideration with the projected results if coming from one API or another.
Thanks
Guille
--
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Datomic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to datomic+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.