Last active
April 16, 2023 17:18
-
-
Save krzdabrowski/301935edb6b96d61b93ec0d991a05e07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private const val APP_DATABASE_NAME = "app_database_name" | |
@Module | |
@InstallIn(SingletonComponent::class) | |
internal object DatabaseModule { | |
@Singleton | |
@Provides | |
fun provideAppDatabase( | |
@ApplicationContext context: Context | |
): AppDatabase { | |
return Room.databaseBuilder( | |
context, | |
AppDatabase::class.java, | |
APP_DATABASE_NAME | |
).build() | |
} | |
@Singleton | |
@Provides | |
fun provideRocketDao(database: AppDatabase): RocketDao { | |
return database.rocketDao() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment