Liking cljdoc? Tell your friends :D

sqlingvo.core


asclj/s

(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`.
sourceraw docstring

ascclj/s

(asc expr)

Parse expr and return an ORDER BY expr using ascending order.

Parse `expr` and return an ORDER BY expr using ascending order.
sourceraw docstring

astclj/s

(ast stmt)

Returns the abstract syntax tree of stmt.

Returns the abstract syntax tree of `stmt`.
sourceraw docstring

cascadeclj/s

(cascade condition)

Add a CASCADE clause to an SQL statement.

Add a CASCADE clause to an SQL statement.
sourceraw docstring

chain-stateclj/s

(chain-state body)
source

checkclj/s

(check expr)

Add a CHECK clause to an SQL statement.

Add a CHECK clause to an SQL statement.
sourceraw docstring

columnclj/s

(column name type & {:as options})

Add a column to stmt.

Add a column to `stmt`.
sourceraw docstring

columnsclj/s

(columns table)

Returns the columns of table.

Returns the columns of `table`.
sourceraw docstring

composeclj/s

(compose stmt & body)

Compose multiple SQL statements.

Compose multiple SQL statements.
sourceraw docstring

concurrentlyclj/s

(concurrently condition)

Add a CONCURRENTLY clause to a SQL statement.

Add a CONCURRENTLY clause to a SQL statement.
sourceraw docstring

continue-identityclj/s

(continue-identity condition)

Add a CONTINUE IDENTITY clause to an SQL statement.

Add a CONTINUE IDENTITY clause to an SQL statement.
sourceraw docstring

copyclj/s

(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"))
sourceraw docstring

create-schemaclj/s

(create-schema db schema & body)

Build a CREATE SCHEMA statement.

Build a CREATE SCHEMA statement.
sourceraw docstring

create-tableclj/s

(create-table db table & body)

Build a CREATE TABLE statement.

Build a CREATE TABLE statement.
sourceraw docstring

create-typeclj/s

(create-type db type & body)

Build a CREATE TYPE sql statement.

Build a CREATE TYPE sql statement.
sourceraw docstring

dbclj/s

(db spec & [opts])

Return a new database for spec.

Return a new database for `spec`.
sourceraw docstring

db?clj/s

(db? x)

Return true if x is a database, otherwise false.

Return true if `x` is a database, otherwise false.
sourceraw docstring

deleteclj/s

(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)))
sourceraw docstring

delimiterclj/s

(delimiter delimiter)

Add a DELIMITER clause to an SQL statement.

Add a DELIMITER clause to an SQL statement.
sourceraw docstring

descclj/s

(desc expr)

Parse expr and return an ORDER BY expr using descending order.

Parse `expr` and return an ORDER BY expr using descending order.
sourceraw docstring

distinctclj/s

(distinct exprs & {:keys [on]})

Parse exprs and return a DISTINCT clause.

Parse `exprs` and return a DISTINCT clause.
sourceraw docstring

do-constraintclj/s

(do-constraint constraint)

Add a DO CONSTRAINT clause to a SQL statement.

Add a DO CONSTRAINT clause to a SQL statement.
sourceraw docstring

do-nothingclj/s

(do-nothing)

Add a DO NOTHING clause to a SQL statement.

Add a DO NOTHING clause to a SQL statement.
sourceraw docstring

do-updateclj/s

(do-update expr)

Add a DO UPDATE clause to a SQL statement.

Add a DO UPDATE clause to a SQL statement.
sourceraw docstring

drop-materialized-viewclj/s

(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)
sourceraw docstring

drop-schemaclj/s

(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])
sourceraw docstring

drop-tableclj/s

(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])
sourceraw docstring

drop-typeclj/s

(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])
sourceraw docstring

encodingclj/s

(encoding encoding)

Add a ENCODING clause to an SQL statement.

Add a ENCODING clause to an SQL statement.
sourceraw docstring

enumclj/s

(enum labels)

Returns the enum ast.

Returns the enum ast.
sourceraw docstring

exceptclj/s

(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]))
sourceraw docstring

excluded-keywordclj/s

(excluded-keyword k)

Returns the keyword k, prefixed with "EXCLUDED.".

Returns the keyword `k`, prefixed with "EXCLUDED.".
sourceraw docstring

excluded-keyword?clj/s

(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.
sourceraw docstring

excluded-kw-mapclj/s

(excluded-kw-map ks)

Returns a map of EXCLUDED ks indexed by ks.

Returns a map of EXCLUDED `ks` indexed by `ks`.
sourceraw docstring

explainclj/s

(explain db stmt & [opts])

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})

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})
sourceraw docstring

fromclj/s

(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"))
sourceraw docstring

group-byclj/s

(group-by & exprs)

Add a GROUP BY clause to an SQL statement.

Add a GROUP BY clause to an SQL statement.
sourceraw docstring

havingclj/s

(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)))
sourceraw docstring

if-existsclj/s

(if-exists condition)

Add a IF EXISTS clause to an SQL statement.

Add a IF EXISTS clause to an SQL statement.
sourceraw docstring

if-not-existsclj/s

(if-not-exists condition)

Add a IF EXISTS clause to an SQL statement.

Add a IF EXISTS clause to an SQL statement.
sourceraw docstring

inheritsclj/s

(inherits & tables)

Add an INHERITS clause to an SQL statement.

Add an INHERITS clause to an SQL statement.
sourceraw docstring

inline-strclj/s

(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.
sourceraw docstring

insertclj/s

(insert db table columns & body)

Build a INSERT statement.

Build a INSERT statement.
sourceraw docstring

intersectclj/s

(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]))
sourceraw docstring

joinclj/s

(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))))
sourceraw docstring

likeclj/s

(like table & {:as opts})

Add a LIKE clause to an SQL statement.

Add a LIKE clause to an SQL statement.
sourceraw docstring

limitclj/s

(limit expr)

Add a LIMIT clause to an SQL statement.

Add a LIMIT clause to an SQL statement.
sourceraw docstring

nullsclj/s

(nulls expr where)

Parse expr and return an NULLS FIRST/LAST expr.

Parse `expr` and return an NULLS FIRST/LAST expr.
sourceraw docstring

offsetclj/s

(offset expr)

Add a OFFSET clause to an SQL statement.

Add a OFFSET clause to an SQL statement.
sourceraw docstring

on-conflictclj/s

(on-conflict target & body)

Add a ON CONFLICT clause to a SQL statement.

Add a ON CONFLICT clause to a SQL statement.
sourceraw docstring

on-conflict-on-constraintclj/s

(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.
sourceraw docstring

order-byclj/s

(order-by & exprs)

Add a ORDER BY clause to an SQL statement.

Add a ORDER BY clause to an SQL statement.
sourceraw docstring

primary-keyclj/s

(primary-key & keys)

Add a PRIMARY KEY clause to a table.

Add a PRIMARY KEY clause to a table.
sourceraw docstring

refresh-materialized-viewclj/s

(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)
sourceraw docstring

restart-identityclj/s

(restart-identity condition)

Add a RESTART IDENTITY clause to an SQL statement.

Add a RESTART IDENTITY clause to an SQL statement.
sourceraw docstring

restrictclj/s

(restrict condition)

Add a RESTRICT clause to an SQL statement.

Add a RESTRICT clause to an SQL statement.
sourceraw docstring

returningclj/s

(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 :*))
sourceraw docstring

selectclj/s

(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))
sourceraw docstring

sqlclj/s

(sql stmt)

Compile stmt into a clojure.java.jdbc compatible vector.

Compile `stmt` into a clojure.java.jdbc compatible vector.
sourceraw docstring

tableclj/s

(table name & body)

Make a new table and return it's AST.

Make a new table and return it's AST.
sourceraw docstring

temporaryclj/s

(temporary condition)

Add a TEMPORARY clause to an SQL statement.

Add a TEMPORARY clause to an SQL statement.
sourceraw docstring

truncateclj/s

(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])
sourceraw docstring

unionclj/s

(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]))
sourceraw docstring

updateclj/s

(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")))
sourceraw docstring

valuesclj/s

(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"}]))
sourceraw docstring

whereclj/s

(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)))
sourceraw docstring

windowclj/s

(window & exprs)

Add a WINDOW clause to an SQL statement.

Add a WINDOW clause to an SQL statement.
sourceraw docstring

withclj/s

(with db bindings query)

Build a WITH (common table expressions) query.

Build a WITH (common table expressions) query.
sourceraw docstring

with-dataclj/s

(with-data data?)

Add a WITH [NO] DATA clause to a SQL statement.

Add a WITH [NO] DATA clause to a SQL statement.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close