This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (3)
- # beginners (28)
- # calva (5)
- # clj-kondo (17)
- # cljsrn (1)
- # clojure (69)
- # clojure-dev (23)
- # clojure-europe (1)
- # clojure-italy (27)
- # clojure-japan (1)
- # clojure-nl (5)
- # clojure-spec (34)
- # clojure-uk (87)
- # cursive (93)
- # datomic (15)
- # duct (6)
- # emacs (3)
- # events (2)
- # garden (1)
- # graalvm (4)
- # jobs (3)
- # malli (1)
- # off-topic (13)
- # onyx (1)
- # pathom (8)
- # pedestal (2)
- # re-frame (13)
- # reitit (5)
- # shadow-cljs (13)
- # sql (13)
- # test-check (5)
- # testing (3)
- # yada (1)
ns declaration in https://github.com/metosin/tilakone#intro example code, why do we need empty
no, but java8 introduced a new time api.
java-time is just a wrapper of this native java api opposed to a wrapper of an external lib (yoda-time).
when dealing with db timestamp field, #inst is return instead of java-time object, it’s kind of annoying and require conversation in order to use java-time function library, any hints or suggestion about that?
you can register your own data reader that converts an #inst to whatever class you want, see https://clojure.org/reference/reader#tagged_literals for info on how to do that!
I don’t think that’s the problem here - inst is just a print format, not a type
class to check the actual type - it’s probably either a java.util.Date or a java.time.Instant, both of which print as #inst
@U064X3EF3 You’re right, date field read from db is
java.sql.Date, which I have to convert to
java.time.LocalDate in order to use java-time library
@U3L6TFEJF Thx for you answer. I’m using HugSql + clojure.java.jdbc, not sure if I can still use data reader to convert into the class that I want :thinking_face:
you should be able to do that, but I've been away from jdbc for a long time
you should use jdbc, I just don't remember the details of how to do what you want
finally got what I want by using
extend-protocol jdbc/IResultSetReadColumn with
result-set-read-column to convert to corresponding java-time equivalent object
Hi! I’m starting to use Hiccup for some simple web frontends. I’m familiar with different web stacks but would like some pointers on idiomatic or just sensible ways to work with Hiccup. Any pointers? Also new enough with Clojure, fwiw. Thanks!
Side question - Hiccup hasn’t been updated in a while. Not that basic HTML has changed much lately, but is there any more active library I should be looking at?
usually you get better answers that more specific you question is, “sensible ways to work with hiccup” is a very broad subject, I suggest you just mess around with it and if you run in to any blockers then ask about that 🙂
just keep in mind hiccup is just used to generate html and it's a clj only library (so no cljs), it (thankfully) does nothing else. Other than that schmee's advice is on point.