Alexander Black
01/18/2023, 10:58 PMinitSqlDriver(SomeDb.Schema)
is either a promise or a coroutine on the JS implementation, and thus is not synchronous, and I need the db at the launch of my code. JS doesn’t have a runBlocking method so there’s no easy way I’ve seen to run this synchronously. And if I wanted to create a koin module single { } for this resource the only way I could do it is by returning a Deferred type. The problem with that is a.) I’d have to update a lot of code. b.) I don’t think that resource would be cached, so it’d end up being like a factory {}, because every time I request that resource I’d have to do a await() call on it, which would just call the initSqlDriver(SomeDb.Schema) function again I believe.
Does anyone have any tips or suggestions on how I can solve this?Derek Ellis
01/18/2023, 11:02 PMSharedDatabase
class here in the docs. The class is Koin-friendly and to use the database you can access the database through the withDatabase
method on the class.Alexander Black
01/18/2023, 11:04 PM