summaryrefslogtreecommitdiff
path: root/src/clojure_sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/clojure_sql')
-rw-r--r--src/clojure_sql/dsl.clj7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/clojure_sql/dsl.clj b/src/clojure_sql/dsl.clj
index 35f296f..13319f3 100644
--- a/src/clojure_sql/dsl.clj
+++ b/src/clojure_sql/dsl.clj
@@ -158,6 +158,13 @@
[prefix]
(prefix-names-matching (constantly true) prefix))
+(defn as-subobject
+ "Prefix all field names with \"{key}.\" to use them as sub-objects
+ in the final result. Can also be useful to disambiguate fields for
+ joins in a regular and predictable manner."
+ [key]
+ (prefix-names (str (name key) \.)))
+
(defn ^:private combine-conjunctions [& wheres]