fixes #458 by adding four registered-*? predicates
This commit is contained in:
parent
5fb150bd53
commit
f8532dfd33
2 changed files with 23 additions and 0 deletions
|
|
@ -1,5 +1,8 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
|
* 2.4.next in progress
|
||||||
|
* Address [#458](https://github.com/seancorfield/honeysql/issues/458) by adding `registered-*?` predicates.
|
||||||
|
|
||||||
* 2.4.972 -- 2023-02-02
|
* 2.4.972 -- 2023-02-02
|
||||||
* Address [#456](https://github.com/seancorfield/honeysql/issues/456) by allowing `format` to handle expressions (like 1.x could) as well as statements. This should aid with migration from 1.x to 2.x.
|
* Address [#456](https://github.com/seancorfield/honeysql/issues/456) by allowing `format` to handle expressions (like 1.x could) as well as statements. This should aid with migration from 1.x to 2.x.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1784,6 +1784,11 @@
|
||||||
(swap! current-clause-order add-clause-before clause before)
|
(swap! current-clause-order add-clause-before clause before)
|
||||||
(swap! clause-format assoc clause f))))
|
(swap! clause-format assoc clause f))))
|
||||||
|
|
||||||
|
(defn registered-clause?
|
||||||
|
"Return true if the clause is known to HoneySQL."
|
||||||
|
[clause]
|
||||||
|
(contains? @clause-format (sym->kw clause)))
|
||||||
|
|
||||||
(defn register-dialect!
|
(defn register-dialect!
|
||||||
"Register a new dialect. Accepts a dialect name (keyword) and a hash
|
"Register a new dialect. Accepts a dialect name (keyword) and a hash
|
||||||
map that must contain at least a `:quoted` key whose value is a unary
|
map that must contain at least a `:quoted` key whose value is a unary
|
||||||
|
|
@ -1814,6 +1819,11 @@
|
||||||
{:dialect-spec dialect-spec}))))
|
{:dialect-spec dialect-spec}))))
|
||||||
(swap! dialects assoc dialect (assoc dialect-spec :dialect dialect)))
|
(swap! dialects assoc dialect (assoc dialect-spec :dialect dialect)))
|
||||||
|
|
||||||
|
(defn registered-dialect?
|
||||||
|
"Return true if the dialect is known to HoneySQL."
|
||||||
|
[dialect]
|
||||||
|
(contains? @dialects dialect))
|
||||||
|
|
||||||
(defn get-dialect
|
(defn get-dialect
|
||||||
"Given a dialect name (keyword), return its definition.
|
"Given a dialect name (keyword), return its definition.
|
||||||
Returns `nil` if the dialect is unknown."
|
Returns `nil` if the dialect is unknown."
|
||||||
|
|
@ -1839,6 +1849,11 @@
|
||||||
{:type (type formatter)})))
|
{:type (type formatter)})))
|
||||||
(swap! special-syntax assoc function f))))
|
(swap! special-syntax assoc function f))))
|
||||||
|
|
||||||
|
(defn registered-fn?
|
||||||
|
"Return true if the function is known to HoneySQL."
|
||||||
|
[function]
|
||||||
|
(contains? @special-syntax (sym->kw function)))
|
||||||
|
|
||||||
(defn register-op!
|
(defn register-op!
|
||||||
"Register a new infix operator. Operators can be defined to be variadic (the
|
"Register a new infix operator. Operators can be defined to be variadic (the
|
||||||
default is that they are binary) and may choose to ignore `nil` arguments
|
default is that they are binary) and may choose to ignore `nil` arguments
|
||||||
|
|
@ -1852,6 +1867,11 @@
|
||||||
(when ignore-nil
|
(when ignore-nil
|
||||||
(swap! op-ignore-nil conj op))))
|
(swap! op-ignore-nil conj op))))
|
||||||
|
|
||||||
|
(defn registered-op?
|
||||||
|
"Return true if the operator is known to HoneySQL."
|
||||||
|
[op]
|
||||||
|
(contains? @infix-ops (sym->kw op)))
|
||||||
|
|
||||||
;; helper functions to create HoneySQL data structures from other things
|
;; helper functions to create HoneySQL data structures from other things
|
||||||
|
|
||||||
(defn map=
|
(defn map=
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue