Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

[tx] Handle map assertion shorthand #180

@ncalexan

Description

@ncalexan

Right now, we don't handle assertions in the map shorthand, like

[{:db/id IDENT :db/attr1 VALUE1 :db/attr2 VALUE2 ...}]

That is equivalent to

[[:db/add IDENT :db/attr1 VALUE1]]
[[:db/add IDENT :db/attr2 VALUE2]]

This ticket tracks parsing such assertions into Entity instances, and transacting such Entity instances.

Datomic allows to drop the :db/id IDENT in nested entities (marked with :db/isComponent?) like

[{:db/id IDENT :db/ref-attr {:db/attr1 VALUE1 ...} ...}]

A tempid in the same partition as IDENT will be generated for the inner entity. And it's possible that even the outer :db/id can be dropped, automatically selecting :db.part/user, although I haven't tested this.

In the Clojure implementation, I expanded from a map into a vector before transacting. I'd very much like to avoid doing that, both to save allocations, and to potentially save tempid lookups; but it's not critical that we're optimal initially.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions