Fork me on GitHub
#sql
<
2021-11-18
>
lauri16:11:12

Hey. What is the recommended way of converting ResultSet’s rows which are of type next.jdbc.result_set$navize_row$fn to usual hashmaps? I’m currently trying to cache the ResultSet (returned by next.jdbc/execute! function) in Redis but it complains about the rows in a ResultSet being of unsupported type..

seancorfield17:11:24

@lauri That's part of the metadata used to support datafy/`nav`, not the rows themselves. I think if you do (mapv #(vary-meta % dissoc 'clojure.core.protocols/nav) results) that should strip the metadata off the rows.

lauri17:11:38

Thank you! I will try that.

lauri08:11:37

Initially got it working with (mapv #(vary-meta % dissoc 'clojure.core.protocols/datafy) results) but ended up using (mapv #(into {} %) results) as it feels a bit cleaner. Thanks again for a quick response!

1
seancorfield17:11:01

Or if the machinery you're using to cache to Redis supports a generic way to remove metadata, that would probably be the better approach.