Skip to content

Instantly share code, notes, and snippets.

@TorkelV
Created October 20, 2020 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TorkelV/3c866f8f04569947df4c7afb96addf59 to your computer and use it in GitHub Desktop.
Save TorkelV/3c866f8f04569947df4c7afb96addf59 to your computer and use it in GitHub Desktop.
@Database(entities = [Phrase::class, Group::class])
abstract class PhraseDatabase : RoomDatabase() {
abstract fun phraseDao(): PhraseDao
}
@Dao
interface PhraseDao {
@Query("SELECT * FROM phrases WHERE `group` = :groupId")
fun getAll(groupId: String): Flow<List<Phrase>>
@Insert
fun insertAll(vararg phrases: Phrase)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment