Liking cljdoc? Tell your friends :D

next.jdbc.sql.builder

Some utility functions for building SQL strings.

These were originally private functions in next.jdbc.sql but they may proof useful to developers who want to write their own 'SQL sugar' functions, such as a database-specific upsert! etc.

Some utility functions for building SQL strings.

These were originally private functions in `next.jdbc.sql` but
they may proof useful to developers who want to write their own
'SQL sugar' functions, such as a database-specific `upsert!` etc.
raw docstring

as-?clj

(as-? key-map opts)

Given a hash map of column names and values, or a vector of column names, return a string of ? placeholders for them.

Given a hash map of column names and values, or a vector of column names,
return a string of `?` placeholders for them.
sourceraw docstring

as-keysclj

(as-keys key-map opts)

Given a hash map of column names and values, return a string of all the column names.

Applies any :column-fn supplied in the options.

Given a hash map of column names and values, return a string of all the
column names.

Applies any `:column-fn` supplied in the options.
sourceraw docstring

by-keysclj

(by-keys key-map clause opts)

Given a hash map of column names and values and a clause type (:set, :where), return a vector of a SQL clause and its parameters.

Applies any :column-fn supplied in the options.

Given a hash map of column names and values and a clause type
(`:set`, `:where`), return a vector of a SQL clause and its parameters.

Applies any `:column-fn` supplied in the options.
sourceraw docstring

for-deleteclj

(for-delete table where-params opts)

Given a table name and either a hash map of column names and values or a vector of SQL (where clause) and its parameters, return a vector of the full DELETE SQL string and its parameters.

Applies any :table-fn / :column-fn supplied in the options.

If :suffix is provided in opts, that string is appended to the DELETE ... statement.

Given a table name and either a hash map of column names and values or a
vector of SQL (where clause) and its parameters, return a vector of the
full `DELETE` SQL string and its parameters.

Applies any `:table-fn` / `:column-fn` supplied in the options.

If `:suffix` is provided in `opts`, that string is appended to the
`DELETE ...` statement.
sourceraw docstring

for-insertclj

(for-insert table key-map opts)

Given a table name and a hash map of column names and their values, return a vector of the full INSERT SQL string and its parameters.

Applies any :table-fn / :column-fn supplied in the options.

If :suffix is provided in opts, that string is appended to the INSERT ... statement.

Given a table name and a hash map of column names and their values,
return a vector of the full `INSERT` SQL string and its parameters.

Applies any `:table-fn` / `:column-fn` supplied in the options.

If `:suffix` is provided in `opts`, that string is appended to the
`INSERT ...` statement.
sourceraw docstring

for-insert-multiclj

(for-insert-multi table cols rows opts)

Given a table name, a vector of column names, and a vector of row values (each row is a vector of its values), return a vector of the full INSERT SQL string and its parameters.

Applies any :table-fn / :column-fn supplied in the options.

If :suffix is provided in opts, that string is appended to the INSERT ... statement.

Given a table name, a vector of column names, and a vector of row values
(each row is a vector of its values), return a vector of the full `INSERT`
SQL string and its parameters.

Applies any `:table-fn` / `:column-fn` supplied in the options.

If `:suffix` is provided in `opts`, that string is appended to the
`INSERT ...` statement.
sourceraw docstring

for-orderclj

(for-order order-by opts)

Given an :order-by vector, return an ORDER BY clause.

Given an `:order-by` vector, return an `ORDER BY` clause.
sourceraw docstring

for-order-colclj

(for-order-col col opts)

Given a column name, or a pair of column name and direction, return the sub-clause for addition to ORDER BY.

Given a column name, or a pair of column name and direction,
return the sub-clause for addition to `ORDER BY`.
sourceraw docstring

for-queryclj

(for-query table where-params opts)

Given a table name and either a hash map of column names and values or a vector of SQL (where clause) and its parameters, return a vector of the full SELECT SQL string and its parameters.

Applies any :table-fn / :column-fn supplied in the options.

If :suffix is provided in opts, that string is appended to the SELECT ... statement.

Given a table name and either a hash map of column names and values or a
vector of SQL (where clause) and its parameters, return a vector of the
full `SELECT` SQL string and its parameters.

Applies any `:table-fn` / `:column-fn` supplied in the options.

If `:suffix` is provided in `opts`, that string is appended to the
`SELECT ...` statement.
sourceraw docstring

for-updateclj

(for-update table key-map where-params opts)

Given a table name, a vector of column names to set and their values, and either a hash map of column names and values or a vector of SQL (where clause) and its parameters, return a vector of the full UPDATE SQL string and its parameters.

Applies any :table-fn / :column-fn supplied in the options.

If :suffix is provided in opts, that string is appended to the UPDATE ... statement.

Given a table name, a vector of column names to set and their values, and
either a hash map of column names and values or a vector of SQL (where clause)
and its parameters, return a vector of the full `UPDATE` SQL string and its
parameters.

Applies any `:table-fn` / `:column-fn` supplied in the options.

If `:suffix` is provided in `opts`, that string is appended to the
`UPDATE ...` statement.
sourceraw docstring

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

× close