Hi
I'm doing this to initialize a h2 database. How do I retrieve the :datasource reference in another namespace? or how should I initialize the database?
I could use integrant.repl.state/system
but I guess it's not its purpose
ig/ref
?
https://github.com/weavejester/integrant/#configurations
Here's a very simple example
There are otherways of doing it, and people may have different takes - but hopefully it may help. Basically, you're just passing functions around 😉
I'll try something like that after work. Thanks. So the idea basically is to use an atom an store a reference to the datasource and then use that atom with next.jdbc?
no
yes
I store an atom that is only for that namespace
I don't pass that atom around (to other namespaces)
Great to know hehehe
If you don't pass it around, you have no option but to create functions like db/execute!
?
It's generally not seen as a good idea to pass atoms around, it's like maintaining a global state for your application, which can lead to complications.
Agreed.