Hyperling bb730f2f0b First Working Revision (#1)
App is now in working order.

Reviewed-on: https://gitea.com/Hyperling/example-android-database-room/pulls/1
Co-authored-by: Hyperling <me@hyperling.com>
Co-committed-by: Hyperling <me@hyperling.com>
2024-12-29 14:53:12 +00:00

30 lines
807 B
Kotlin

package com.hyperling.roomexample
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Query
import androidx.room.Upsert
import kotlinx.coroutines.flow.Flow
@Dao
interface ContactDao {
// 2024-12-28
// If these complain about return type errors, try upgrading
// the ROOM version, otherwise remove the SUSPEND keyword.
@Upsert
suspend fun upsertContact(contact: Contact)
@Delete
suspend fun deleteContact(contact: Contact)
@Query("SELECT * FROM contact ORDER BY firstName ASC")
fun selectContactsFN(): Flow<List<Contact>>
@Query("SELECT * FROM contact ORDER BY lastName ASC")
fun selectContactsLN(): Flow<List<Contact>>
@Query("SELECT * FROM contact ORDER BY phoneNumber ASC")
fun selectContactsPN(): Flow<List<Contact>>
}