(as expr alias & [columns])
Parse expr
and return an expr with and AS clause using alias
.
Parse `expr` and return an expr with and AS clause using `alias`.
(asc expr)
Parse expr
and return an ORDER BY expr using ascending order.
Parse `expr` and return an ORDER BY expr using ascending order.
(ast stmt)
Returns the abstract syntax tree of stmt
.
Returns the abstract syntax tree of `stmt`.
(cascade condition)
Add a CASCADE clause to an SQL statement.
Add a CASCADE clause to an SQL statement.
(check expr)
Add a CHECK clause to an SQL statement.
Add a CHECK clause to an SQL statement.
(column name type & {:as options})
Add a column to stmt
.
Add a column to `stmt`.
(columns table)
Returns the columns of table
.
Returns the columns of `table`.
(compose stmt & body)
Compose multiple SQL statements.
Compose multiple SQL statements.
(concurrently condition)
Add a CONCURRENTLY clause to a SQL statement.
Add a CONCURRENTLY clause to a SQL statement.
(continue-identity condition)
Add a CONTINUE IDENTITY clause to an SQL statement.
Add a CONTINUE IDENTITY clause to an SQL statement.
(copy db table columns & body)
Build a COPY statement.
Examples:
(copy db :country [] (from :stdin))
(copy db :country [] (from "/usr1/proj/bray/sql/country_data"))
Build a COPY statement. Examples: (copy db :country [] (from :stdin)) (copy db :country [] (from "/usr1/proj/bray/sql/country_data"))
(create-schema db schema & body)
Build a CREATE SCHEMA statement.
Build a CREATE SCHEMA statement.
(create-table db table & body)
Build a CREATE TABLE statement.
Build a CREATE TABLE statement.
(create-type db type & body)
Build a CREATE TYPE sql statement.
Build a CREATE TYPE sql statement.
(db spec & [opts])
Return a new database for spec
.
Return a new database for `spec`.
(db? x)
Return true if x
is a database, otherwise false.
Return true if `x` is a database, otherwise false.
(delete db table & body)
Build a DELETE statement.
Examples:
(delete db :continents)
(delete db :continents (where '(= :id 1)))
Build a DELETE statement. Examples: (delete db :continents) (delete db :continents (where '(= :id 1)))
(delimiter delimiter)
Add a DELIMITER clause to an SQL statement.
Add a DELIMITER clause to an SQL statement.
(desc expr)
Parse expr
and return an ORDER BY expr using descending order.
Parse `expr` and return an ORDER BY expr using descending order.
(distinct exprs & {:keys [on]})
Parse exprs
and return a DISTINCT clause.
Parse `exprs` and return a DISTINCT clause.
(do-constraint constraint)
Add a DO CONSTRAINT clause to a SQL statement.
Add a DO CONSTRAINT clause to a SQL statement.
(do-nothing)
Add a DO NOTHING clause to a SQL statement.
Add a DO NOTHING clause to a SQL statement.
(do-update expr)
Add a DO UPDATE clause to a SQL statement.
Add a DO UPDATE clause to a SQL statement.
(drop-materialized-view db view & body)
Build a DROP MATERIALIZED VIEW statement.
Examples:
(drop-materialized-view db :order-summary)
Build a DROP MATERIALIZED VIEW statement. Examples: (drop-materialized-view db :order-summary)
(drop-schema db schemas & body)
Build a DROP SCHEMA statement.
Examples:
(drop-schema db [:my-schema])
Build a DROP SCHEMA statement. Examples: (drop-schema db [:my-schema])
(drop-table db tables & body)
Build a DROP TABLE statement.
Examples:
(drop-table db [:continents])
(drop-table db [:continents :countries])
Build a DROP TABLE statement. Examples: (drop-table db [:continents]) (drop-table db [:continents :countries])
(drop-type db types & body)
Build a DROP TYPE statement.
Examples:
(drop-type db [:mood])
(drop-table db [:my-schema.mood])
Build a DROP TYPE statement. Examples: (drop-type db [:mood]) (drop-table db [:my-schema.mood])
(encoding encoding)
Add a ENCODING clause to an SQL statement.
Add a ENCODING clause to an SQL statement.
(except & args)
Build an EXCEPT statement.
Examples:
(except (select db [1]) (select db [2]))
(except {:all true} (select db [1]) (select db [2]))
Build an EXCEPT statement. Examples: (except (select db [1]) (select db [2])) (except {:all true} (select db [1]) (select db [2]))
(excluded-keyword k)
Returns the keyword k
, prefixed with "EXCLUDED.".
Returns the keyword `k`, prefixed with "EXCLUDED.".
(excluded-keyword? k)
Returns true if the keyword k
is prefixed with "EXCLUDED.",
otherwise false.
Returns true if the keyword `k` is prefixed with "EXCLUDED.", otherwise false.
(excluded-kw-map ks)
Returns a map of EXCLUDED ks
indexed by ks
.
Returns a map of EXCLUDED `ks` indexed by `ks`.
(explain db stmt & [opts])
Return an EXPLAIN statement for stmt
. opts
can be a map with
the following key/value pairs:
Examples:
(explain db (select db [:*] (from :foo)))
(explain db (select db [:*] (from :foo)) {:analyze true})
Return an EXPLAIN statement for `stmt`. `opts` can be a map with the following key/value pairs: - :analyze boolean - :buffers boolean - :costs boolean - :format :json, :text, :yaml, :xml - :timing boolean - :verbose boolean Examples: (explain db (select db [:*] (from :foo))) (explain db (select db [:*] (from :foo)) {:analyze true})
(from & from)
Add a FROM clause to an SQL statement. The from
forms can be one
or more tables, :stdin, a filename or an other sub query.
Examples:
(select db [:*] (from :continents))
(select db [:*] (from :continents :countries) (where '(= :continents.id :continent-id)))
(select db [:*] (from (as (select [1 2 3]) :x)))
(copy db :country [] (from :stdin))
(copy db :country [] (from "/usr1/proj/bray/sql/country_data"))
Add a FROM clause to an SQL statement. The `from` forms can be one or more tables, :stdin, a filename or an other sub query. Examples: (select db [:*] (from :continents)) (select db [:*] (from :continents :countries) (where '(= :continents.id :continent-id))) (select db [:*] (from (as (select [1 2 3]) :x))) (copy db :country [] (from :stdin)) (copy db :country [] (from "/usr1/proj/bray/sql/country_data"))
(group-by & exprs)
Add a GROUP BY clause to an SQL statement.
Add a GROUP BY clause to an SQL statement.
(having condition & [combine])
Add a HAVING clause to an SQL statement.
Examples:
(select db [:city '(max :temp-lo)] (from :weather) (group-by :city) (having '(< (max :temp-lo) 40)))
Add a HAVING clause to an SQL statement. Examples: (select db [:city '(max :temp-lo)] (from :weather) (group-by :city) (having '(< (max :temp-lo) 40)))
(if-exists condition)
Add a IF EXISTS clause to an SQL statement.
Add a IF EXISTS clause to an SQL statement.
(if-not-exists condition)
Add a IF EXISTS clause to an SQL statement.
Add a IF EXISTS clause to an SQL statement.
(inherits & tables)
Add an INHERITS clause to an SQL statement.
Add an INHERITS clause to an SQL statement.
(inline-str s)
Compile s
as an inline string, instead of a prepared statement
parameter.
WARNING: You have to make sure the string s
is safe against SQL
injection attacks yourself.
Compile `s` as an inline string, instead of a prepared statement parameter. WARNING: You have to make sure the string `s` is safe against SQL injection attacks yourself.
(insert db table columns & body)
Build a INSERT statement.
Build a INSERT statement.
(intersect & args)
Build an INTERSECT statement.
Examples:
(intersect (select db [1]) (select db [2]))
(intersect {:all true} (select db [1]) (select db [2]))
Build an INTERSECT statement. Examples: (intersect (select db [1]) (select db [2])) (intersect {:all true} (select db [1]) (select db [2]))
(join from condition & {:keys [type outer pk]})
Add a JOIN clause to a statement.
Examples:
(select db [:*] (from :countries) (join :continents '(using :id)))
(select db [:*] (from :continents) (join :countries.continent-id :continents.id))
(select db [:*] (from :countries) (join :continents '(on (= :continents.id :countries.continent-id))))
Add a JOIN clause to a statement. Examples: (select db [:*] (from :countries) (join :continents '(using :id))) (select db [:*] (from :continents) (join :countries.continent-id :continents.id)) (select db [:*] (from :countries) (join :continents '(on (= :continents.id :countries.continent-id))))
(like table & {:as opts})
Add a LIKE clause to an SQL statement.
Add a LIKE clause to an SQL statement.
(limit expr)
Add a LIMIT clause to an SQL statement.
Add a LIMIT clause to an SQL statement.
(nulls expr where)
Parse expr
and return an NULLS FIRST/LAST expr.
Parse `expr` and return an NULLS FIRST/LAST expr.
(offset expr)
Add a OFFSET clause to an SQL statement.
Add a OFFSET clause to an SQL statement.
(on-conflict target & body)
Add a ON CONFLICT clause to a SQL statement.
Add a ON CONFLICT clause to a SQL statement.
(on-conflict-on-constraint target & body)
Add a ON CONFLICT ON CONSTRAINT clause to a SQL statement.
Add a ON CONFLICT ON CONSTRAINT clause to a SQL statement.
(order-by & exprs)
Add a ORDER BY clause to an SQL statement.
Add a ORDER BY clause to an SQL statement.
(primary-key & keys)
Add a PRIMARY KEY clause to a table.
Add a PRIMARY KEY clause to a table.
(refresh-materialized-view db view & body)
Build a REFRESH MATERIALIZED VIEW statement.
Examples:
(refresh-materialized-view db :order-summary)
Build a REFRESH MATERIALIZED VIEW statement. Examples: (refresh-materialized-view db :order-summary)
(restart-identity condition)
Add a RESTART IDENTITY clause to an SQL statement.
Add a RESTART IDENTITY clause to an SQL statement.
(restrict condition)
Add a RESTRICT clause to an SQL statement.
Add a RESTRICT clause to an SQL statement.
(returning & exprs)
Add a RETURNING clause to an SQL statement.
Examples:
(insert db :distributors [] (values [{:did 106 :dname "XYZ Widgets"}]) (returning :*))
(update db :films {:kind "Dramatic"} (where '(= :kind "Drama")) (returning :*))
Add a RETURNING clause to an SQL statement. Examples: (insert db :distributors [] (values [{:did 106 :dname "XYZ Widgets"}]) (returning :*)) (update db :films {:kind "Dramatic"} (where '(= :kind "Drama")) (returning :*))
(select db exprs & body)
Build a SELECT statement.
Examples:
(select db [1])
(select db [:*] (from :continents))
(select db [:id :name] (from :continents))
Build a SELECT statement. Examples: (select db [1]) (select db [:*] (from :continents)) (select db [:id :name] (from :continents))
(sql stmt)
Compile stmt
into a clojure.java.jdbc compatible vector.
Compile `stmt` into a clojure.java.jdbc compatible vector.
(table name & body)
Make a new table and return it's AST.
Make a new table and return it's AST.
(temporary condition)
Add a TEMPORARY clause to an SQL statement.
Add a TEMPORARY clause to an SQL statement.
(truncate db tables & body)
Build a TRUNCATE statement.
Examples:
(truncate db [:continents])
(truncate db [:continents :countries])
Build a TRUNCATE statement. Examples: (truncate db [:continents]) (truncate db [:continents :countries])
(union & args)
Build a UNION statement.
Examples:
(union (select db [1]) (select db [2]))
(union {:all true} (select db [1]) (select db [2]))
Build a UNION statement. Examples: (union (select db [1]) (select db [2])) (union {:all true} (select db [1]) (select db [2]))
(update db table row & body)
Build a UPDATE statement.
Examples:
(update db :films {:kind "Dramatic"} (where '(= :kind "Drama")))
Build a UPDATE statement. Examples: (update db :films {:kind "Dramatic"} (where '(= :kind "Drama")))
(values vals)
(values db vals)
Return a VALUES statement or clause.
Examples:
(values db [[1 "one"] [2 "two"] [3 "three"]])
(insert db :distributors [] (values [{:did 106 :dname "XYZ Widgets"}]))
Return a VALUES statement or clause. Examples: (values db [[1 "one"] [2 "two"] [3 "three"]]) (insert db :distributors [] (values [{:did 106 :dname "XYZ Widgets"}]))
(where condition & [combine])
Add a WHERE clause to an SQL statement.
Examples:
(select db [1] (where '(in 1 (1 2 3))))
(select db [*] (from :continents) (where '(= :name "Europe")))
(delete db :continents (where '(= :id 1)))
Add a WHERE clause to an SQL statement. Examples: (select db [1] (where '(in 1 (1 2 3)))) (select db [*] (from :continents) (where '(= :name "Europe"))) (delete db :continents (where '(= :id 1)))
(window & exprs)
Add a WINDOW clause to an SQL statement.
Add a WINDOW clause to an SQL statement.
(with db bindings query)
Build a WITH (common table expressions) query.
Build a WITH (common table expressions) query.
(with-data data?)
Add a WITH [NO] DATA clause to a SQL statement.
Add a WITH [NO] DATA clause to a SQL statement.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close