More helper docstrings

This commit is contained in:
Sean Corfield 2021-02-14 17:20:24 -08:00
parent ea4e120252
commit f6a38e4024

View file

@ -158,6 +158,13 @@
column description is a sequence of SQL elements column description is a sequence of SQL elements
that specify the name and the attributes. that specify the name and the attributes.
(with-columns [:id :int [:not nil]]
[:name [:varchar 32] [:default \"\"]])
Produces:
id INT NOT NULL,
name VARCHAR(32) DEFAULT ''
Can also accept a single argument which is a Can also accept a single argument which is a
collection of column descriptions (mostly for collection of column descriptions (mostly for
compatibility with nilenso/honeysql-postgres compatibility with nilenso/honeysql-postgres
@ -208,34 +215,60 @@
;; these five need to supply an empty hash map since they wrap ;; these five need to supply an empty hash map since they wrap
;; all of their arguments: ;; all of their arguments:
(defn intersect (defn intersect
[& args] "Accepts any number of SQL clauses (queries) on
(generic :intersect (cons {} args))) which to perform a set intersection."
[& clauses]
(generic :intersect (cons {} clauses)))
(defn union (defn union
[& args] "Accepts any number of SQL clauses (queries) on
(generic :union (cons {} args))) which to perform a set union."
[& clauses]
(generic :union (cons {} clauses)))
(defn union-all (defn union-all
[& args] "Accepts any number of SQL clauses (queries) on
(generic :union-all (cons {} args))) which to perform a set union all."
[& clauses]
(generic :union-all (cons {} clauses)))
(defn except (defn except
[& args] "Accepts any number of SQL clauses (queries) on
(generic :except (cons {} args))) which to perform a set except."
[& clauses]
(generic :except (cons {} clauses)))
(defn except-all (defn except-all
[& args] "Accepts any number of SQL clauses (queries) on
(generic :except-all (cons {} args))) which to perform a set except all."
[& clauses]
(generic :except-all (cons {} clauses)))
(defn select (defn select
[& args] "Accepts any number of column names, or column/alias
(generic :select args)) pairs, or SQL expressions (optionally aliased):
(select :id [:foo :bar] [[:max :quux]])
Produces: SELECT id, foo AS bar, MAX(quux)"
[& exprs]
(generic :select exprs))
(defn select-distinct (defn select-distinct
"Like `select` but produces SELECT DISTINCT."
[& args] [& args]
(generic :select-distinct args)) (generic :select-distinct args))
(defn select-distinct-on (defn select-distinct-on
"Accepts a sequence of one or more columns for the
distinct clause, followed by any number of column
names, or column/alias pairs, or SQL expressions
(optionally aliased), as for `select`:
(select-distinct-on [:a :b] :c [:d :dd])
Produces: SELECT DISTINCT ON(a, b) c, d AS dd"
{:arglists '([distinct-cols & exprs])}
[& args] [& args]
(generic :select-distinct-on args)) (generic :select-distinct-on args))
@ -256,8 +289,10 @@
(generic :delete-from args)) (generic :delete-from args))
(defn truncate (defn truncate
"Accepts a single table name to truncate."
{:arglists '([table])}
[& args] [& args]
(generic :truncate args)) (generic-1 :truncate args))
(defn columns (defn columns
[& args] [& args]