Support something like a `:reverse-label-fn` for fetching values a column without using a row builder with a key that doesn't exactly match the column name #221
Say I have a table with snake_case keys and I'm fetching results with something like as-unqualified-kebab-maps that has a :label-fn that transforms the results to kebab-case. If I fetch an entire row, I would get
because it never uses the result map builder at all... I would have to in this case just know that the column is actually updated_at and write my map transducer using that key instead.
My suggestion was to support some sort of option like :reverse-label-fn (default clojure.core/name) and use that places in mapify-result-set like entryAt instead of calling name directly, e.g.
I think this would actually increase performance a bit since you would avoid repeated var dereferences of #'clojure.core/name, but either way it would be completely negligible compared to the cost of actually running the query, especially when your DB isn't in-memory H2.
As discussed here: https://clojurians.slack.com/archives/C1Q164V29/p1662494291800529
Say I have a table with
snake_case
keys and I'm fetching results with something likeas-unqualified-kebab-maps
that has a:label-fn
that transforms the results tokebab-case
. If I fetch an entire row, I would getbut if I just wanted to fetch values of :updated-at I can't do something like
because it never uses the result map builder at all... I would have to in this case just know that the column is actually
updated_at
and write my map transducer using that key instead.My suggestion was to support some sort of option like
:reverse-label-fn
(defaultclojure.core/name
) and use that places inmapify-result-set
likeentryAt
instead of callingname
directly, e.g.I think this would actually increase performance a bit since you would avoid repeated var dereferences of
#'clojure.core/name
, but either way it would be completely negligible compared to the cost of actually running the query, especially when your DB isn't in-memory H2.