honey.sql
(source)Primary API for HoneySQL 2.x.
This includes the `format` function -- the primary entry point -- as well
as several public formatters that are intended to help users extend the
supported syntax.
In addition, functions to extend HoneySQL are also provided here:
* `clause-order` -- returns the current clause priority ordering;
intended as aid when registering new clauses.
* `format-dsl` -- intended to format SQL statements; returns a vector
containing a SQL string followed by parameter values.
* `format-entity` -- intended to format SQL entities; returns a string
representing the SQL entity.
* `format-expr` -- intended to format SQL expressions; returns a vector
containing a SQL string followed by parameter values.
* `format-expr-list` -- intended to format a list of SQL expressions;
returns a pair comprising: a sequence of SQL expressions (to be
join with a delimiter) and a sequence of parameter values.
* `register-clause!` -- register a new statement/clause formatter.
* `register-fn!` -- register a new function call (or special syntax)
formatter.
* `register-op!` -- register a new operator formatter.
* `set-dialect!` -- set the default dialect to be used for formatting,
and optionally set a global `:quoted` option.
* `sql-kw` -- turns a Clojure keyword (or symbol) into SQL code (makes
it uppercase and replaces - with space).
For more info about this library see:
https://cljdoc.org/d/com.github.seancorfield/honeysql/2.5.1103/doc/getting-startedPublic Variable | Short Description |
---|---|
->numbered (clj) | |
->numbered-param (clj) | |
add-clause-before (clj) | Low-level helper just to insert a new clause. |
clause-body (clj) | If the current DSL expression being formatted contains the specified clause (as a keyword or symbol), returns that clause's value. |
clause-format (clj) | |
clause-order (clj) | Return the current order that known clauses will be applied when formatting a data structure into SQL. |
columns-from-values (clj) | |
contains-clause? (clj) | Returns true if the current DSL expression being formatted contains the specified clause (as a keyword or symbol). |
format (clj) | Turn the data DSL into a vector containing a SQL string followed by any parameter values that were encountered in the DSL structure. |
format& (clj) | Experimental implementation of https://github.com/seancorfield/honeysql/issues/495 Implicitly treats any locally bound symbol as a variable to be substituted in the symbolic SQL expression. |
format-dsl (clj) | Given a hash map representing a SQL statement and a hash map of options, return a vector containing a string -- the formatted SQL statement -- followed by any parameter values that SQL needs. |
format-entity (clj) | Given a simple SQL entity (a keyword or symbol -- or string), return the equivalent SQL fragment (as a string -- no parameters). |
format-expr (clj) | Given a data structure that represents a SQL expression and a hash map of options, return a vector containing a string -- the formatted SQL statement -- followed by any parameter values that SQL needs. |
format-expr-list (clj) | Given a sequence of expressions represented as data, return a pair where the first element is a sequence of SQL fragments and the second element is a sequence of parameters. |
format-interspersed-expr-list (clj) | If there are inline (SQL) keywords, use them to join the formatted expressions together. |
format-selectable-dsl (clj) | |
format-selects-common (clj) | |
formatf (clj) | Experimental implementation of https://github.com/seancorfield/honeysql/issues/495 Currently, does not support options. |
formatv (clj) | Experimental implementation of https://github.com/seancorfield/honeysql/issues/495 Treats the specified vector of symbols as variables to be substituted in the symbolic SQL expression. |
get-dialect (clj) | Given a dialect name (keyword), return its definition. |
ignore-respect-nulls (clj) | |
map= (clj) | Given a hash map, return a condition structure that can be used in a WHERE clause to test for equality: {:select :* :from :table :where (sql/map= {:id 1})} will produce: SELECT * FROM table WHERE id = ? (and a parameter of 1). |
register-clause! (clj) | Register a new clause formatter. |
register-dialect! (clj) | Register a new dialect. |
register-fn! (clj) | Register a new function (as special syntax). |
register-op! (clj) | Register a new infix operator. |
registered-clause? (clj) | Return true if the clause is known to HoneySQL. |
registered-dialect? (clj) | Return true if the dialect is known to HoneySQL. |
registered-fn? (clj) | Return true if the function is known to HoneySQL. |
registered-op? (clj) | Return true if the operator is known to HoneySQL. |
set-dialect! (clj) | Set the default dialect for formatting. |
set-options! (clj) | Set default values for any or all of the following options: * :checking * :inline * :numbered * :quoted * :quoted-always * :quoted-snake Note that calling `set-dialect!` can override the default for `:quoted`. |
sql-kw (clj) | Given a keyword, return a SQL representation of it as a string. |
strop (clj) | Escape any embedded closing strop characters. |
through-opts (clj) | If org.clojure/core.cache is available, resolves to a function that calls core.cache.wrapped/lookup-or-miss, otherwise to a function that throws an exception. |
upper-case (clj) | Upper-case a string in Locale/US to avoid locale-specific capitalization. |