feat: di, db, and preliminary server-side gtfs parsing
This commit is contained in:
parent
ccc748dc1f
commit
6770c01613
22 changed files with 555 additions and 24 deletions
|
|
@ -0,0 +1,12 @@
|
|||
package moe.lava.banksia.di
|
||||
|
||||
import moe.lava.banksia.room.Database
|
||||
import org.koin.dsl.module
|
||||
|
||||
val CommonModules = module {
|
||||
includes(PlatformModule)
|
||||
|
||||
single { Database.build(get<PlatformDatabaseBuilder>().getBuilder()) }
|
||||
single { get<Database>().getRouteDao() }
|
||||
single { get<Database>().getShapeDao() }
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package moe.lava.banksia.di
|
||||
|
||||
import androidx.room.RoomDatabase
|
||||
import moe.lava.banksia.room.Database
|
||||
import org.koin.core.parameter.ParametersHolder
|
||||
import org.koin.core.scope.Scope
|
||||
import org.koin.dsl.module
|
||||
|
||||
interface PlatformDatabaseBuilder {
|
||||
fun getBuilder(): RoomDatabase.Builder<Database>
|
||||
}
|
||||
|
||||
expect fun Scope.provideDatabaseBuilder(p: ParametersHolder): PlatformDatabaseBuilder
|
||||
|
||||
internal val PlatformModule = module {
|
||||
single { provideDatabaseBuilder(it) }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue