Fork me on GitHub
#sql
<
2020-03-16
>
kwladyka10:03:02

Are namepsaces keywords useful in any way with next.jdbc.sql/update! ?

kwladyka10:03:13

I am asking, because I want to do fn like this

(defn update-by-uuid! [table data] (sql/update! db table data {:uuid (:uuid data}))
And I hav concern about :uuid , because here will be :shop/uuid os something else.

kwladyka10:03:32

So I have to remove all namespaces keyword here to make this simple

kwladyka10:03:51

just thinking if I lose any advantage because of this here?

seancorfield17:03:27

You are over-thinking. The docs talk about this and you can pass qualified or unqualified names and both will work in update! etc @kwladyka

👍 4
seancorfield17:03:19

You should stop worrying about qualified keywords and just get used to them 🙂

4
seancorfield17:03:35

In other words, both of the following will work:

(defn update-by-uuid! [table data] (sql/update! db table data {:shop/uuid (:uuid data}))
(defn update-by-uuid! [table data] (sql/update! db table data {:uuid (:uuid data}))
and so would
(defn update-by-uuid! [table data] (sql/update! db table data (select-keys data [:uuid]))) ; if data has simple keys
(defn update-by-uuid! [table data] (sql/update! db table data (select-keys data [:shop/uuid]))) ; if data has qualified keys
The whole point (of next.jdbc working this way) is to allow you to use qualified keys easily.

kwladyka17:03:50

that is what I was thinking, but wanted to be sure if I don’t lose some not obviously advantages