Created UserAccount entity and UserAccountDao to create the UserAccounts db table with Room

This commit is contained in:
Severiano Jaramillo 2018-10-31 14:51:23 -06:00
parent c0d20e67bd
commit e835e7de89
3 changed files with 31 additions and 0 deletions

View file

@ -11,6 +11,7 @@ abstract class BitsyDatabase : RoomDatabase() {
abstract fun assetDao(): AssetDao
abstract fun balanceDao(): BalanceDao
abstract fun userAccountDao(): UserAccountDao
companion object {

View file

@ -0,0 +1,17 @@
package cy.agorise.bitsybitshareswallet.daos
import androidx.lifecycle.LiveData
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import cy.agorise.bitsybitshareswallet.models.UserAccount
@Dao
interface UserAccountDao {
@Query("SELECT * FROM user_accounts")
fun getAllUserAccounts(): LiveData<List<UserAccount>>
@Insert
fun insert(userAccount: UserAccount)
}

View file

@ -0,0 +1,13 @@
package cy.agorise.bitsybitshareswallet.models
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.PrimaryKey
@Entity(tableName = "user_accounts")
data class UserAccount (
@PrimaryKey
@ColumnInfo(name = "id") val id: String,
@ColumnInfo(name = "name") val name: String,
@ColumnInfo(name = "is_ltm") val isLtm: Boolean // Todo verify data type
)