Add example of custom naming via result set builder
This commit is contained in:
parent
8405193209
commit
88fcaa5869
1 changed files with 8 additions and 0 deletions
|
|
@ -22,6 +22,14 @@ In addition, the following generic builders can take `:label-fn` and `:qualifier
|
||||||
* `as-modified-arrays` -- table-qualified keywords,
|
* `as-modified-arrays` -- table-qualified keywords,
|
||||||
* `as-unqualified-modified-arrays` -- simple keywords.
|
* `as-unqualified-modified-arrays` -- simple keywords.
|
||||||
|
|
||||||
|
An example builder that converts `snake_case` database table/column names to `kebab-case` keywords:
|
||||||
|
|
||||||
|
```clojure
|
||||||
|
(defn as-kebab-maps [rs opts]
|
||||||
|
(let [kebab #(str/replace % #"_" "-")]
|
||||||
|
(result-set/as-modified-maps rs (assoc opts :qualifier-fn kebab :label-fn kebab))))
|
||||||
|
```
|
||||||
|
|
||||||
## RowBuilder Protocol
|
## RowBuilder Protocol
|
||||||
|
|
||||||
This protocol defines four functions and is used whenever `next.jdbc` needs to materialize a row from a `ResultSet` as a Clojure data structure:
|
This protocol defines four functions and is used whenever `next.jdbc` needs to materialize a row from a `ResultSet` as a Clojure data structure:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue