pellucidanalytics/datomisca — pull request #37 by dwhjames (2013-03-06 19:29:07+00:00)
Title: New conversions to and from DatomicData types

A major refactoring of DDReader and DDWriter.

We now have a series of type classes, for converting Scala types to Datomic types
1. `ToDatomicInj` is an injective mapping from Scala to Datomic
2. `ToDatomic` is the extension of `ToDatomicInj` with additional mappings that make it no longer injective
3. `ToDatomicCast` which is a specialization of `ToDatomic` where the result is fixed as `DatomicData` rather than the more precise subtype that `ToDatomic` gives (it is an upcast)

Similarly we have `FromDatomicInj`, `FromDatomic`, and `FromDatomicCast`. However, while `FromDatomicInj` is an injective, type function, `FromDatomic` is now a relation (a multi-valued function). `FromDatomicCast` fixes `FromDatomic` at `DatomicData`, so it is a down cast and a converter.

We also have extended `SchemaDEntityOps` with `read[T](attr)` and `readOpt[T](attr)` which make use of `FromDatomic` to have flexible, schema-typed reads from entities. (The type parameter is required, as `FromDatomic` is a type relation).