Turns expressions as printed by PostgreSQL's deparser (pg_get_constraintdef, pg_get_expr) into HoneySQL-style data. Only that output format is supported, not arbitrary SQL.
Covered: comparison, logical and arithmetic operators; IS [NOT] NULL/TRUE/FALSE; IN; ANY/ALL (ARRAY[...]); BETWEEN; LIKE/ILIKE/~/~*; ::casts; function calls; TRIM(BOTH FROM x); CASE; CURRENT_TIMESTAMP and friends; AT TIME ZONE; (x).field; x[i]; quoted identifiers; string, number, boolean and NULL literals.
Operators whose symbol is not a readable EDN keyword (~, @>, ...) get a named keyword (see edn-safe-ops); ->honeysql maps them back when SQL has to be generated.
Turns expressions as printed by PostgreSQL's deparser (pg_get_constraintdef, pg_get_expr) into HoneySQL-style data. Only that output format is supported, not arbitrary SQL. Covered: comparison, logical and arithmetic operators; IS [NOT] NULL/TRUE/FALSE; IN; ANY/ALL (ARRAY[...]); BETWEEN; LIKE/ILIKE/~/~*; ::casts; function calls; TRIM(BOTH FROM x); CASE; CURRENT_TIMESTAMP and friends; AT TIME ZONE; (x).field; x[i]; quoted identifiers; string, number, boolean and NULL literals. Operators whose symbol is not a readable EDN keyword (~, @>, ...) get a named keyword (see edn-safe-ops); ->honeysql maps them back when SQL has to be generated.
(->honeysql e)Replaces the EDN-safe operator names with the symbols HoneySQL formats.
Replaces the EDN-safe operator names with the symbols HoneySQL formats.
(canonical e)Undoes rewrites PostgreSQL applies when deparsing, without changing meaning: numeric literals printed as casts ('-1'::integer -> -1), array casts, col = ANY (ARRAY[...]) -> [:in col [...]], col <> ALL (ARRAY[...]) -> [:not-in col [...]], and a one-element IN -> =.
Undoes rewrites PostgreSQL applies when deparsing, without changing meaning:
numeric literals printed as casts ('-1'::integer -> -1), array casts,
col = ANY (ARRAY[...]) -> [:in col [...]], col <> ALL (ARRAY[...]) -> [:not-in col [...]],
and a one-element IN -> =.(check-clause s)The expression inside "CHECK (...)" as data. Trailing NOT VALID / NO INHERIT are ignored.
The expression inside "CHECK (...)" as data. Trailing NOT VALID / NO INHERIT are ignored.
PostgreSQL operators whose keyword form is not readable EDN, and the names used instead.
PostgreSQL operators whose keyword form is not readable EDN, and the names used instead.
(parse s)Expression string -> data. Throws ex-info with :input (and :pos or :got) when it cannot be read.
Expression string -> data. Throws ex-info with :input (and :pos or :got) when it cannot be read.
(try-parse s)Like parse, but returns {:expr e} or {:error message :input s}.
Like parse, but returns {:expr e} or {:error message :input s}.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |