toucan2
toucan2 copied to clipboard
Support returning different map types besides `Instance`
This was in Toucan 2 at one point, but I ultimately removed it in one of the many simplification passes
"Magic map" support is one use case, or even returning Toucan 1 record types if you're a kook. Maybe you just want plain maps? Who knows.
Put me down for plain maps.
I use into {}
pretty often, e.g.:
(keys (t2/hydrate (t2/select Database :id 1337) :tables))
Which fails with
Error printing return value (ClassCastException) at clojure.lang.APersistentMap$KeySeq/first (APersistentMap.java:168).
class toucan2.instance.Instance cannot be cast to class java.util.Map$Entry (toucan2.instance.Instance is in unnamed module of loader clojure.lang.DynamicClassLoader @7731595c; java.util.Map$Entry is in module java.base of loader 'bootstrap')
I'm also a big fan of "just gimme a map." Maybe supporting datafy
would do it?