luminus-framework / conman

a helper library for managing database connections
Eclipse Public License 1.0
122 stars 27 forks source link

Don't rely on (instance? IDeref ...) in bind-connection #50

Closed dryewo closed 6 years ago

dryewo commented 6 years ago

Closes #49.

Right after defstate mount states are of type mount.core.DerefableState that implements IDeref, no matter whether :cljc mode is on or off. This is how bind-connection sees it when it's called to generate functions from queries.sql, making them call deref on the connection every time.

In the default :clj mode after the first start a state turns into the real value, which, in case of database connections, is not IDeref, just a plain map. After the stop, it turns into mount.core.NotStartedState, which is also not IDeref.

I used mount in tests to reproduce this situation.

yogthos commented 6 years ago

looks good