From ef96e04cb6bc4aa5a187f2f2ac5d21bef646d216 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sun, 20 Sep 2020 11:43:43 -0700 Subject: [PATCH 1/2] Add note to with-options to see usage examples/caveats below --- doc/getting-started.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/getting-started.md b/doc/getting-started.md index 74fb5ea..708a398 100644 --- a/doc/getting-started.md +++ b/doc/getting-started.md @@ -140,6 +140,8 @@ user=> (jdbc/execute-one! ds-opts ["select * from address where id = ?" 4]) user=> ``` +> Note: See the `next.jdbc/with-option` examples in the [**Datasources, Connections & Transactions**](#datasources-connections--transactions) below for some caveats around using this function. + If you have [camel-snake-kebab](https://clj-commons.org/camel-snake-kebab/) on your classpath, two pre-built option hash maps are available in `next.jdbc`: * `snake-kebab-opts` -- provides `:column-fn`, `:table-fn`, `:label-fn`, `:qualifier-fn`, and `:builder-fn` that will convert Clojure identifiers in `:kebab-case` to SQL entities in `snake_case` and will produce result sets with qualified `:kebab-case` names from SQL entities that use `snake_case`, * `unqualified-snake-kebab-opts` -- provides `:column-fn`, `:table-fn`, `:label-fn`, `:qualifier-fn`, and `:builder-fn` that will convert Clojure identifiers in `:kebab-case` to SQL entities in `snake_case` and will produce result sets with _unqualified_ `:kebab-case` names from SQL entities that use `snake_case`. From 0142b25dc6f980c381106dfa5bed1948b35e47b0 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Sun, 20 Sep 2020 12:17:21 -0700 Subject: [PATCH 2/2] Add note to with-options docstring about usage in Getting Started section --- src/next/jdbc.clj | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/next/jdbc.clj b/src/next/jdbc.clj index d4ad409..6824733 100644 --- a/src/next/jdbc.clj +++ b/src/next/jdbc.clj @@ -286,7 +286,13 @@ (defn with-options "Given a connectable/transactable object and a set of (default) options that should be used on all operations on that object, return a new - wrapper object that can be used in its place." + wrapper object that can be used in its place. + + Bear in mind that `get-datasource`, `get-connection`, and `with-transaction` + return plain Java objects, so if you call any of those on this wrapped + object, you'll need to re-wrap the Java object `with-options` again. See + the Datasources, Connections & Transactions section of Getting Started for + more details, and some examples of use with these functions." [connectable opts] (opts/->DefaultOptions connectable opts))