Created UserAccount entity and UserAccountDao to create the UserAccounts db table with Room
This commit is contained in:
parent
c0d20e67bd
commit
e835e7de89
3 changed files with 31 additions and 0 deletions
|
@ -11,6 +11,7 @@ abstract class BitsyDatabase : RoomDatabase() {
|
||||||
|
|
||||||
abstract fun assetDao(): AssetDao
|
abstract fun assetDao(): AssetDao
|
||||||
abstract fun balanceDao(): BalanceDao
|
abstract fun balanceDao(): BalanceDao
|
||||||
|
abstract fun userAccountDao(): UserAccountDao
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
}
|
|
@ -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
|
||||||
|
)
|
Loading…
Reference in a new issue