This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-11
Channels
- # announcements (3)
- # asami (4)
- # babashka (79)
- # babashka-sci-dev (47)
- # beginners (97)
- # biff (12)
- # calva (7)
- # clj-commons (3)
- # clj-kondo (22)
- # clj-on-windows (13)
- # cljdoc (31)
- # cljfx (2)
- # cljs-dev (1)
- # clojure (85)
- # clojure-austin (4)
- # clojure-dev (12)
- # clojure-europe (15)
- # clojure-italy (8)
- # clojure-nl (4)
- # clojure-uk (4)
- # community-development (19)
- # conjure (3)
- # core-typed (40)
- # cursive (9)
- # datahike (21)
- # datomic (1)
- # emacs (7)
- # exercism (2)
- # graalvm (20)
- # graphql (1)
- # honeysql (16)
- # jobs (1)
- # malli (2)
- # off-topic (3)
- # pathom (28)
- # pedestal (3)
- # polylith (7)
- # reitit (14)
- # releases (1)
- # remote-jobs (1)
- # rewrite-clj (4)
- # shadow-cljs (21)
- # sql (21)
- # testing (8)
- # tools-deps (23)
- # vscode (8)
- # xtdb (38)
Hi all!
I was wondering if using a result (perhaps just a fixed value?) from a (jdbc/with-transaction ...)
block (which does some inserts) is a sufficient check whether the transaction was executed successfully? Like anything other than an exception is a success… Or is there a better way to conditionally run business logic after a transaction?
If I have a keyword value on clojure, what would be the way to store that in sql? how about reading it back to a keyword (namespaced) in next.jdbc?
you'd need to convert it to edn
not sure I follow, what would be the type I would use in e.g. Postgresql? I was thinking string so that I can do indexing etc, you mean converting it manually on writing/reading?
I was wondering if there was a way to automatically convert a given column , but I guess doing the conversion when reading/writing does also work
that will convert to/from json for you. I'm sure there's a way to like make a custom type in postgres and add automatic conversion with edn but really that seems like a huge pain
I was thinking on primite type colums (a string in DB that is a keyword on clojure, or enum in pg maybe?), but I’ll also need that for json/edn interop, thanks
hmm enums like described here might be what I was looking for: https://www.bevuta.com/en/blog/using-postgresql-enums-in-clojure/
that jdbc/IResultSetReadColumn
looks like it could potentially cause some issues
if any other string column gets one of the enum values it would automatically convert that, too
also that looks like it's using the old version of jdbc for clojure
specifically clojure.java.jdbc instead of the newer next.jdbc
I'd just accept that it's going to be a string, myself
yes you’re right, I think I’d change the implementation, though going for enums might be a reasonable approach (as the kw values I was thinking of are specced as sets of possible values in clojure)
absolutely
I’ll investigate a bit more but it looks like the solution will come from one of those two approaches
👍:skin-tone-2: