From 4d3b3175202e8e502b6f060c8cd2bdbd324fe5a0 Mon Sep 17 00:00:00 2001 From: Sean Corfield Date: Fri, 25 Sep 2020 17:10:25 -0700 Subject: [PATCH] Add meta unwrap for more feature support --- src/honey/sql.cljc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/honey/sql.cljc b/src/honey/sql.cljc index 1486441..a8019b5 100644 --- a/src/honey/sql.cljc +++ b/src/honey/sql.cljc @@ -528,6 +528,13 @@ {:valid-dialects (vec (sort (keys dialects)))}))) dialect) +(defn- unwrap [x opts] + (if-let [m (meta x)] + (if-let [f (::wrapper m)] + (f x opts) + x) + x)) + (defn format "Turn the data DSL into a vector containing a SQL string followed by any parameter values that were encountered in the DSL structure." @@ -544,7 +551,7 @@ *quoted* (if (contains? opts :quoted) (:quoted opts) dialect?)] - (format-dsl data))))) + (mapv #(unwrap % opts) (format-dsl data)))))) (defn set-dialect! "Set the default dialect for formatting.