Fork me on GitHub
#xtdb
<
2021-12-18
>
sheluchin17:12:25

Is there some common terminology to distinguish between an entity map and an entity map with an :xt/id key? Some distinction to make it clear whether you're dealing with an db doc or plain map.. maybe just document vs. map?

refset17:12:12

an XT document is a map that (1) has a valid :xt/id (2) uses only keyword keys ("fields" / "attributes") and (3) is serializable with Nippy

refset17:12:39

> maybe just document vs. map :thumbsup:

1
malcolmsparks17:12:06

Personally I tend to refer to them as entities, even though I probably mean 'the current document for this entity'.

refset17:12:27

Indeed, an entity is essentially just a timeline of documents correlated by a consistent :xt/id, but from the perspective of a concrete "as-of" db value (a.k.a. "snapshot" / "timeslice") we generally stick to using the term "entity" (e.g. when discussing q, pull, or entity API calls). The other way to frame it is that documents are physical, whereas entities are conceptual.

sheluchin17:12:48

The reason I ask is because I want to put some https://github.com/fulcrologic/guardrails instrumentation in my DB layer and therefore need a spec for both a) an entity map with all the fields to describe it and b) that same entity, but ready to be inserted to the DB or has been retrieved from it (i.e. has :xt/id). So, need a name for each. And there should be many such pairs, so a consistent naming scheme should help..

👍 2
sheluchin17:12:05

Sounds like entity vs. map or doc are reasonable choices. Thanks for the input!

🙏 1