toucan icon indicating copy to clipboard operation
toucan copied to clipboard

Allow DB to be passed as an argument to models

Open weavejester opened this issue 8 years ago • 3 comments

Can the database be passed as an argument to the models, or does Toucan only support the database connection as a global var?

weavejester avatar May 28 '17 19:05 weavejester

currently it only supports the global var but you can bind *db-connection* if you want to use a different database.

it does sound like it could be a useful feature to have, however, so I'll edit the title of this issue accordingly

camsaul avatar May 31 '17 20:05 camsaul

this will likely require reworking things a bit since the internal Toucan DB functions all call (db-connection) to get a connection to the current DB

camsaul avatar May 31 '17 20:05 camsaul

I would even go further and separate out the query forming and query execution aspect. This way we could use async DB drivers, since JDBC is not scaling well. A bootstrap function could provide functions that either deliver actual results or futures, depending on the DB drivers used.

beders avatar Jul 17 '18 16:07 beders