This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-24
Channels
I am having an issue related to dates and postgresql. I want to insert a record with 3 fields (1 string and 2 dates), however, I am getting this error: PSQLException Can't infer the SQL type to use for an instance of org.joda.time.DateTime. Use setObject() with an explicit Types value to specify the type to use. org.postgresql.jdbc2.AbstractJdbc2Statement.setObject (AbstractJdbc2Statement.java:2134)
@rcanepa alternatives if you don't to transform your map enter/leaving db, implement jdbc protocls, eg https://github.com/nowprovision/webhookproxyweb/blob/master/src/webhookproxyweb/jdbc.clj
@nowprovision: Are you suggesting me to use JSONB types? Is that similar to work with MongoDB?
@rcanepa: If you implement ISQLParameter
in clojure.java.jdbc
, you won't have to explicitly convert your DateTime objects to its SQL equivalent. For example, I've used this before for automatically converting java.util.Date to java.sql.Date. You can do the same type of thing for Joda's DateTime as well.
(extend-protocol jdbc/ISQLParameter
java.util.Date
(set-parameter [v ^PreparedStatement ps ^long i]
(.setObject ps i (java.sql.Date. (.getTime v)))))
@solicode: Thanks, now I understand what @nowprovision tried to say with his suggestion.
hey all! So I'm using pedestal with immutant and I want to add websockets. All the tutorials speak about (immutant.web.middleware/wrap-websockets compojure-routes my-ws-callbacks)
stuff, but I don't have those routes, I have pedestal and it's interceptors. Any ideas how to do that with pedestal?
@spacepluk: clojure.test
for clj and cljs.test
for cljs. You can find some guidance in the following links: https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-14.md https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-15.md and https://github.com/magomimmo/modern-cljs/blob/master/doc/second-edition/tutorial-16.md
@magomimmo: thanks!
@spacepluk: you’re welcome
Hiii. I’m doing some ETL-ish code, and trying to filter a map by another map. I’m attempting Specter (couldn’t figure out Traversy for this, but I’m OK with using it) — however, I don’t understand how to get
select
to return a map, instead of a value. Here’s the Q I asked. Any ideas? https://github.com/nathanmarz/specter/issues/45OK, why does (conj [(or (= 1 1) +)] 1 2 3) ;;=> [true 1 2 3]
while (conj '(or (= 1 1) +) 1 2 3) ;;=> (3 2 1 or (= 1 1) +)
? Why doesn’t (or (= 1 1) +)
evaluate to true in the latter case?
for more info on ’
https://clojuredocs.org/clojure.core/quote
'(or (= 1 1) +)
is (quote (or (= 1 1) +))
With list
, your code will work the way you probably intended it to:
(conj (list (or (= 1 1) +)) 1 2 3)
Does anyone from pubnub hang out here? One of them gave a presentation about how they use samza and clojure together and I was wondering if they could share any code demonstrating how they glue it all together