This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-13
Channels
- # aleph (6)
- # announcements (10)
- # asami (3)
- # babashka (111)
- # babashka-sci-dev (20)
- # beginners (28)
- # calva (28)
- # clj-http (1)
- # clj-kondo (23)
- # cljs-dev (16)
- # cljsrn (23)
- # clojure (116)
- # clojure-czech (3)
- # clojure-europe (33)
- # clojure-nl (1)
- # clojure-norway (7)
- # clojure-uk (5)
- # clojurescript (41)
- # community-development (2)
- # cursive (5)
- # datahike (4)
- # datomic (13)
- # figwheel-main (3)
- # fulcro (11)
- # google-cloud (1)
- # gratitude (8)
- # hyperfiddle (14)
- # jobs (2)
- # lsp (22)
- # malli (4)
- # off-topic (4)
- # other-languages (4)
- # pathom (13)
- # portal (40)
- # rdf (11)
- # reitit (1)
- # sci (15)
- # shadow-cljs (7)
- # specter (1)
- # sql (6)
- # xtdb (4)
How do people write database functions (on prem)? Using quote (`'`) as per the https://docs.datomic.com/on-prem/reference/database-functions.html#cancel doesn't feel very ergonomic.
I remember seeing some gist macro-thing for that a long time ago, but I can't find it anymore
If you use Conformity to apply your schema it’s just EDN so you don’t have to quote the function definitions. That said, life got a lot easier when we switched to using classpath functions rather than defining them inline in the tx data.
Right. I've used conformity. I don't it/EDN makes for more ergonomic function definitions. Classpath functions: Aha. I didn't try that. Only problem I see is a slow/somewhat cumbersome development/deploy cycle... I wrote a small rewrite-clj-thing that extracts a single namespace into a transactor function, maybe I should make that a public library. It has worked well for - well - single namespace functions so far.
yeah, the deploy cycle is more cumbersome, but the development cycle is IME much better. You can develop them as normal Clojure functions, test them with or without a database, etc.
Right. Thanks :-)
> You can develop them as normal Clojure functions, test them with or without a database, etc. This is also what is possible with the rewrite-clj-"strategy", limited as of now to a single namespace.
Thanks @U3ZUC5M0R, I hadn't heard about datofu. However I don't think/see that it offers better ergonomics for writing database functions though.
@UGJE0MM0W you saw the db-fn helper?
(def foo (db-fn :some/fn
'{:lang "clojure"
:requires ([datomic.api :as d] [clojure.string :as str])
:params [db args]
:code (let [{:keys [foo]} args]
(prn ::hello-fn))}))
Yes, I did, and thanks again. I think the easiness of using that style is about the same as the example in the documentation that uses quote
Here is my take on this: https://github.com/ivarref/gen-fn Feedback is appreciated 🙂 CC @U3ZUC5M0R @U060QM7AA