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

[tx] Accept [a v] notation for lookup refs in entity position #392

Open
ncalexan opened this issue Mar 28, 2017 · 0 comments
Open

[tx] Accept [a v] notation for lookup refs in entity position #392

ncalexan opened this issue Mar 28, 2017 · 0 comments

Comments

@ncalexan
Copy link
Member

This is follow-up tracking #382 (review). In #382, I accept only (lookup-ref a v) for lookup-refs in both entity and value position (e and v in a [:db/add e _ v] assertion). That's contrary to Datomic, which accepts embedded vectors like [a v] in both locations, treating ambiguity in some ad-hoc way. (See the discussion in #183 for notes on this ambiguity.)

This ticket tracks accepting an embedded vector [a v] in the entity position only. We suspect that the majority of lookup refs are entity refs in this form, and it's both shorter to type and handy to agree with Datomic.

To implement this, you'll need to:

  1. verify that entid_or_lookup_ref_or_temp_id is still used only to parse entity positions;
  2. add a vector_lookup_ref function accepting [a v] around
    fn value_to_lookup_ref(val: &Value) -> Option<LookupRef> {
    ;
  3. use your new function around
    .or(Tx::<I>::lookup_ref().map(EntidOrLookupRefOrTempId::LookupRef))
    ;
  4. add tests demonstrating you can used nested vectors in entity position and that you can use nested vectors in value position -- but they're not interpreted as lookup refs. This latter may already be tested by the existing tests!
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants