tonsky / datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
Eclipse Public License 1.0
5.5k stars 309 forks source link

Throw an error if passed-in db is deref-able #101

Closed sgrove closed 9 years ago

sgrove commented 9 years ago

Would you accept a patch that would throw an error via a pre-condition (so it can be removed in production builds with no perf hit) if a user passes in a db/conn that supports deref to d/q, d/entity, or d/pull? It would help new users in particular when they forget to deref the db, and end up with an error saying Uncaught Error: [object Object] is not ISeqable

tonsky commented 9 years ago

Sounds like a good idea. Please use datascript.core/db? for the check