#398 add names for all ops; hash is mnemonic for #
This commit is contained in:
parent
ab7c235329
commit
2e7da61f56
1 changed files with 26 additions and 16 deletions
|
|
@ -2,24 +2,34 @@
|
||||||
|
|
||||||
(ns honey.sql.pg-json
|
(ns honey.sql.pg-json
|
||||||
"Register all the PostgreSQL JSON/JSONB operators
|
"Register all the PostgreSQL JSON/JSONB operators
|
||||||
and provide convenient Clojure names for those ops
|
and provide convenient Clojure names for those ops.
|
||||||
that cannot be written as keywords or symbols directly."
|
|
||||||
|
For the seven that cannot be written directly as
|
||||||
|
symbols, use mnemonic names: hash for # and at for @.
|
||||||
|
|
||||||
|
For the four of those that cannot be written as
|
||||||
|
keywords, invoke the `keyword` function instead.
|
||||||
|
|
||||||
|
Those latter four (`at>`, `<at`, `at?`, and `atat`)
|
||||||
|
are the only ones that should really be needed in the
|
||||||
|
DSL. The other names are provided for completeness."
|
||||||
|
(:refer-clojure :exclude [-> ->> -])
|
||||||
(:require [honey.sql :as sql]))
|
(:require [honey.sql :as sql]))
|
||||||
|
|
||||||
;; see https://www.postgresql.org/docs/current/functions-json.html
|
;; see https://www.postgresql.org/docs/current/functions-json.html
|
||||||
|
|
||||||
;; :->
|
(def -> "The -> operator." :->)
|
||||||
;; :->>
|
(def ->> "The ->> operator." :->>)
|
||||||
;; :#>
|
(def hash> "The #> operator." :#>)
|
||||||
;; :#>>
|
(def hash>> "The #>> operator." :#>>)
|
||||||
(def at> "The @> operator." (keyword "@>"))
|
(def at> "The @> operator." (keyword "@>"))
|
||||||
(def <at "The <@ operator." (keyword "<@"))
|
(def <at "The <@ operator." (keyword "<@"))
|
||||||
;; :?
|
(def ? "The ? operator." :?)
|
||||||
;; :?|
|
(def ?| "The ?| operator." :?|)
|
||||||
;; :?&
|
(def ?& "The ?& operator." :?&)
|
||||||
;; :||
|
(def || "The || operator." :||)
|
||||||
;; :-
|
(def - "The - operator." :-)
|
||||||
;; :#-
|
(def hash- "The #- operator." :#-)
|
||||||
(def at? "The @? operator." (keyword "@?"))
|
(def at? "The @? operator." (keyword "@?"))
|
||||||
(def atat "The @@ operator." (keyword "@@"))
|
(def atat "The @@ operator." (keyword "@@"))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue