This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-21
Channels
- # announcements (4)
- # aws (29)
- # aws-lambda (1)
- # babashka (21)
- # beginners (143)
- # calva (47)
- # cider (31)
- # clj-kondo (24)
- # cljsrn (4)
- # clojure (70)
- # clojure-australia (3)
- # clojure-czech (1)
- # clojure-europe (97)
- # clojure-greece (4)
- # clojure-nl (3)
- # clojure-uk (45)
- # clojurescript (70)
- # code-reviews (1)
- # conjure (7)
- # cursive (10)
- # datomic (13)
- # duct (5)
- # emacs (1)
- # fulcro (38)
- # graalvm (1)
- # graphql (9)
- # honeysql (13)
- # integrant (33)
- # jobs (14)
- # jobs-rus (1)
- # malli (7)
- # off-topic (72)
- # pathom (1)
- # re-frame (11)
- # reitit (9)
- # remote-jobs (2)
- # sci (11)
- # shadow-cljs (9)
- # sql (5)
- # tools-deps (5)
- # xtdb (6)
hello everyone. I feel like I'm completely lost. Is there a more than minimal example project using integrant that one can inspect? I'm right now struggling with the ergonomics of having an open connection and using this open connection to do something with it. I have a database connection open and my functions take a connection as a first parameter but having the caller access the system-map every and getting out the currently opened connection feels weird.
to give an additional insight into my current confusion: I see two options, having the caller grab the connection from the system-map and providing it to the callee or have the callee function receive the system-map as arg1 and getting the connection out of there itself
the 2nd option would be fine if it weren't for the repeating of the same code (the get-in) and the bad ergonomics of normal repl development where I have to construct an unnecessarily large map with the right keys just to run my new functions
Generally the idea is to define request handlers as ig/init-key
s, then they reference the database connection in their opts. I'm not sure what kind of an application you're building though
I'm trying to fit integrant into an already established work in progress system that has quite a bit of state, as it sources events from 5 places and so far I've used mount to keep those systems decoupled
but the state is making repl testing cumbersome so I wanted to try integrant but I don't get how I go from the simple jetty single event handler model to my I have events in several subsystems
maybe I have to redesign it and make a application wide queue and that way I can pipe everything through one place
I think using Integrant in an existing application will be a bit difficult. When building a new Duct app, all your state runs through the integrant map
So if you're planning on using an existing codebase without making it fit into integrant, I'm not sure if that'll be a good choice (however, anyone can feel free to prove me wrong)
I'm fine with retrofitting it because I would like to gain the ability to test while the dev system is running
You could manipulate a dynamic var with integrant init-keys.. But then it's not much different from using component / mount (I think)
yeah I saw a tutorial on integrant that just used a system atom which is referenced everywhere
maybe I should make a new duct application and just get a feel for how it's done there and try to build a minimal example outside of duct because my application has nothing to do with the web
a desktop program (at this point in time, web will come later) that grabs things from all kinds of places and shows them in a GUI while sourcing events from filesystem watcher and window titles, websites and excel files
it's bespoke and there are 10 people in the world that may find it useful that all have the same job as me 😉
so lots of state and trying to keep it from getting out of control using any means necessary
the dependency graph is basically me putting everything into a database and having the GUI try to create its state from the choices in the GUI and the DB only
But the basic gist of Duct is pretty straightforward:
[`Database` / logging
] <-- ref --- handler
<--- ref --- router
<--- ref --- webserver
Then your application starts Integrant with a root key (for example, the webserver), which starts all the dependent components
Router takes all the handlers and puts them in the right place. And the handler references things that it needs. For example a database connection
maybe by thinking in those terms I can solve my mapping issue, I'll try the duct template and try to create some basic CRUD stuff in the database
Also, even though Duct markets itself as a "server-side application framework", I don't think there's anything stopping you from using it in a GUI application
thanks @kevin.van.rooijen, time to get my hands dirty 😉