Back

builder-adapter (clj)

(source)

function

(builder-adapter builder-fn column-by-index-fn)
Given any builder function (e.g., `as-lower-maps`) and a column reading function, return a new builder function that uses that column reading function instead of `.getObject` and `read-column-by-index` so you can override the default behavior. The default column-by-index-fn behavior would be equivalent to: (defn default-column-by-index-fn [builder ^ResultSet rs ^Integer i] (read-column-by-index (.getObject rs i) (:rsmeta builder) i)) Your column-by-index-fn can use the result set metadata `(:rsmeta builder)` and/or the (processed) column name `(nth (:cols builder) (dec i))` to determine whether to call `.getObject` or some other method to read the column's value, and can choose whether or not to use the `ReadableColumn` protocol-based value processor (and could add metadata to the value to satisfy that protocol on a per-instance basis).

Examples