democracyworks / datomic-toolbox

Datomic Utility Library
19 stars 0 forks source link

Decouple from resource-config #7

Closed cap10morgan closed 9 years ago

cap10morgan commented 9 years ago

This PR is something I made while getting frustrated by my inability to easily use some of datomic-toolbox's features from a REPL that was connected to a different Datomic transactor than was configured in config.edn and my slight annoyance at having to update this library in order to use the latest resource-config version in an app that depended on both of them.

It is intended to start a conversation about how we would like datomic-toolbox and resource-config to interact. As such it goes all the way to the extreme of removing the resource-config dependency entirely, putting all state into atoms, and providing stateless alternatives to all fns that weren't either a) already stateless or b) provided in datomic.api already.

It should be compatible with existing datomic-toolbox consumers with one exception: You must now pass in your Datomic config (which are more than welcome to get from resource-config) into the datomic-toolbox.core/initialize function. If you aren't using initialize (and really, why wouldn't you? it's idempotent), then you can call the new datomic-toolbox.core/configure! fn first instead. Either of these setup the internal Datomic config state so that the stateful fns work the way you're used to.

All the tests still pass.

tie-rack commented 9 years ago

This is welcome work!

cap10morgan commented 9 years ago

@tie-rack & @ericnormand I dropped the unnecessary default-connection atom for now so we would at least have a coherent PR to comment on. But please feel free to keep asking questions about it.

ericnormand commented 9 years ago

I look forward to using the library with this patch.

ericnormand commented 9 years ago

The code looks really good. The functionality is more than welcome.

LGTM