Fork me on GitHub
#beginners
<
2018-07-07
>
Jay02:07:35

I have found that the autogensym reader macro is not applied on quoted code, e.g. 'x# yields the symbol x# rather than x__auto__1234 or similar. However other reader macros are evaluated inside of quoted code. Is there any significance to this behavior or is it an unimportant detail?

sundarj03:07:21

@jayvmithani x# isn't a reader macro, it's a feature of syntax-quote (`) in particular

alice03:07:30

So, I have this function that is probably wrong for multiple reasons, I'm trying to learn hugsql with little sql experience and I do not like how this function looks.

(defn update! [{id :id
                username :username
                api-key :api_key
                email :email
                password-hash :password_hash}]
  (when-some [x username] (update-username! id username))
  (when-some [x api-key] (update-api-key! id api-key))
  (when-some [x email] (update-email! id email))
  (when-some [x password-hash] (update-password-hash! id password-hash)))
I have individual functions to update each column I want to be updateable, and it seems easy to just when-some do the update, but this is fugly. Does anyone have any suggestions?

alice03:07:29

Unless anyone knows if it's possible for me to do something in hugsql where I can supply a map and update only the supplied keys with the sql.

alice03:07:44

Years of mongodb spoiled me

valerauko03:07:22

@alice so you're thinking of giving it the whole map but only want to update certain columns?

alice03:07:57

Well, I was unable to write hugsql/sql functions that update more than one column at a time, but this may be a me problem and not a hugsql/sql problem

alice03:07:13

and because I was only able to update one at a time, I decided a general update function would be appropriate to handle all

valerauko03:07:48

let's take this to #hugsql

valerauko15:07:28

are there any code highlighting libraries in clojure (or java) that are preferably simple and light? ideally something i could use like (highlight lang text). clojure and ruby support is a must, the more the merrier. do you know of anything like that?

perkele17:07:55

[:form {:on-submit on_click :class "my form"}
How to prevent page reload when I click enter in my form?

noisesmith17:07:22

is this using reagent?

perkele17:07:29

I guess

(.preventDefault e)
is framework agnostic

noisesmith17:07:05

the reason I ask is because I assume the reload is being caused by your DOM rendering framework

noisesmith17:07:50

oh, sorry, you are seeing a reload, as in hitting the backend instead of a re-render of the page?

rakyi17:07:46

@ihorgorobets I haven’t used rum, but I think adding that preventDefault to submit event should be enough