tonsky/datascript — pull request #14 by pangloss (2014-08-10 03:47:27+00:00)
Title: Implemented a persistent Entity type and a few other features

I've kept all of my changes in the extensions ns, but some (or maybe all) of these things would actually be better merged into the datascript ns itself, so in that sense this isn't quite ready to merge.

I've implemented several features here:

- semi-lazy Entity type (datoms are looked up but not munged into kv pairs)
- implement assoc / dissoc on Entity by tracking the history in the returned immutable entity itself
- entities that have changes can be applied to the db with `(transact! c [entity ...])`
- Explicitly create / lookup / delete entities
- entity lookup against a TxReport resolves tempids automatically
- Track history datoms in the DB (they are broadly useful even if not queryable)
- Allow new relationships to be added to a schema
- Allow transact! to handle raw maps of data, including maps with string keys

I'd love to see this merged eventually and would be happy to adjust / discuss and hear your feedback.