mozilla / mentat

UNMAINTAINED A persistent, relational store inspired by Datomic and DataScript.
https://mozilla.github.io/mentat/
Apache License 2.0
1.65k stars 115 forks source link

[meta] Full Datalog type support (instants, UUIDs, URIs) #201

Open ncalexan opened 7 years ago

ncalexan commented 7 years ago

Over in #170, I simplified things by not including placeholders for Mentat value types I wasn't going to support at the start: :db.type/instant, :db.type/uuid, and :db.type/uri. (We might consider supporting JSON and a binary blob type like :db.type/bytes as well.)

This ticket tracks supporting these types. Off the top, this will mean:

  1. Adding new DB_TYPE_* values to the bootstrapper;
  2. Bumping the SQL schema to accommodate the new idents;
  3. Adding new ValueType cases;
  4. Adding corresponding TypedValue cases;
  5. Implementing the conversions to and from SQL;
  6. testing the new types in the transactor and potentially in the query engine as well.
ncalexan commented 7 years ago

There are some fledgling tests for SQL conversion (step 5. above) of other TypedValue instances around https://github.com/ncalexan/mentat/commit/3e3d74023fc0ed4c045f2f3a5f4abf5c8af8941b. (They haven't landed quite yet.)

I expect the following encoding:

The value type tags above agree with those in the Clojure implementation: see https://github.com/mozilla/mentat/blob/master/src/common/datomish/sqlite_schema.cljc#L246.

Writing real tests isn't really possible until #214 and some follow-ups land, so step 6. above might need a follow-up ticket.

rnewman commented 7 years ago

Filed #426, #427, #431 for this.