From edd268ae7d4fa20875d2a3ae4e8137da62a8160b Mon Sep 17 00:00:00 2001 From: Gary Fredericks Date: Thu, 1 May 2014 17:26:33 +0000 Subject: [PATCH] Maintain the arglist metadata for helpers This should hopefully make documentation via clojure.repl/doc and others a bit more readable. --- src/honeysql/helpers.clj | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/honeysql/helpers.clj b/src/honeysql/helpers.clj index 91c1ca2..0646928 100644 --- a/src/honeysql/helpers.clj +++ b/src/honeysql/helpers.clj @@ -10,11 +10,14 @@ (let [kw (keyword (name helper))] `(do (defmethod build-clause ~kw ~(into ['_] arglist) ~@more) - (defn ~helper [& args#] - (let [[m# args#] (if (map? (first args#)) - [(first args#) (rest args#)] - [{} args#])] - (build-clause ~kw m# args#)))))) + (doto (defn ~helper [& args#] + (let [[m# args#] (if (map? (first args#)) + [(first args#) (rest args#)] + [{} args#])] + (build-clause ~kw m# args#))) + ;; maintain the original arglist instead of getting + ;; ([& args__6880__auto__]) + (alter-meta! assoc :arglists '(~arglist)))))) (defn collify [x] (if (coll? x) x [x]))