integrant

nmkip 2019-10-22T01:29:28.005400Z

Hi

nmkip 2019-10-22T01:32:26.005700Z

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?

nmkip 2019-10-22T01:39:52.006800Z

I could use integrant.repl.state/system but I guess it's not its purpose

dharrigan 2019-10-22T08:39:02.011600Z

Here's a very simple example

dharrigan 2019-10-22T08:39:02.011700Z

https://github.com/dharrigan/nextjdbc-integrant

dharrigan 2019-10-22T08:39:28.012400Z

There are otherways of doing it, and people may have different takes - but hopefully it may help. Basically, you're just passing functions around 😉

nmkip 2019-10-22T09:44:07.017400Z

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?

dharrigan 2019-10-22T09:45:17.017600Z

no

dharrigan 2019-10-22T09:45:21.017900Z

yes

dharrigan 2019-10-22T09:45:32.018200Z

I store an atom that is only for that namespace

dharrigan 2019-10-22T09:45:37.018400Z

I don't pass that atom around (to other namespaces)

nmkip 2019-10-22T11:32:00.018600Z

Great to know hehehe

nmkip 2019-10-22T11:32:54.018800Z

If you don't pass it around, you have no option but to create functions like db/execute!?

dharrigan 2019-10-22T12:18:06.019200Z

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.

nmkip 2019-10-22T17:19:56.019400Z

Agreed.