Fork me on GitHub
#malli
<
2023-09-04
>
ikitommi11:09:47

thanks for sharing, was interesting!

escherize15:09:10

Yeah I was reading it, thinking “Malli fits this usecase super well” then shocked to see it mentioned directly 😂

Karol Wójcik05:09:22

How can I define a Datomic Ref as a malli schema?

steveb8n05:09:18

I might help if you can be more specific. we use Datomic and Malli together

Karol Wójcik06:09:59

Hmm, I’m building set of scrapers for the same domain, but I get the data from different sources. Every scraper implementation has to satisfy a certain protocol, so then I can transact the results adapted to the unified model. I would like to provide a schema for this edge of the system to make sure I’m not transacting 💩. However, I’m not sure how the ref should be defined here. I wanted to use something like: [:some.diatomic/attribute [:or TFullEntity TDatomicRef]] Is there some predicate in the datomic API, so that I can check if the attribute is indeed a ref?

Karol Wójcik06:09:41

It seems ref is just a number. Thought it’s some sort of a Ref type that is shown as a number. I will define it as a number? then ;)

steveb8n06:09:25

ah ok. we use uuids for all entities with a standard key and always using idents for refs. that way it’s easy to create a schema because every ref is [k uuid]

steveb8n06:09:44

i.e. we never transact a ref using the :db/id

steveb8n06:09:37

does that work for you? having uuids is generally a good idea for datomic entities in case you ever want to export/import

steveb8n06:09:26

and yes, :db/id is just a number

Karol Wójcik21:09:01

Hmm, this will not work for me. I'm not having uuids, but composite tuples since I'm not in control of the source of the data and for composite tuples I need to resolve the entity-ids 😄

Karol Wójcik21:09:24

Thank you so much for help @U0510KXTU!