Included a brain key model and simple DAO stub

This commit is contained in:
Nelson R. Perez 2018-11-01 14:50:18 -05:00
parent 1932b27f7e
commit ff43dcc4f4
3 changed files with 35 additions and 1 deletions

View file

@ -11,7 +11,11 @@ import cy.agorise.bitsybitshareswallet.models.*
Balance::class,
UserAccount::class,
Authority::class,
UserAccountAuthority::class
UserAccountAuthority::class,
BrainKey::class,
EquivalentValue::class,
Operation::class,
Transfer::class
], version = 1, exportSchema = false)
abstract class BitsyDatabase : RoomDatabase() {
@ -20,6 +24,7 @@ abstract class BitsyDatabase : RoomDatabase() {
abstract fun userAccountDao(): UserAccountDao
abstract fun authorityDao(): AuthorityDao
abstract fun userAccountAuthorityDao(): UserAccountAuthorityDao
abstract fun brainKeyDao(): BrainKeyDao
companion object {

View file

@ -0,0 +1,16 @@
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.BrainKey
@Dao
interface BrainKeyDao {
@Insert
fun insert(asset: BrainKeyDao)
@Query("SELECT * FROM brain_keys")
fun getAllBrainKeys(): LiveData<List<BrainKey>>
}

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="brain_keys")
data class BrainKey(
@PrimaryKey
@ColumnInfo(name = "public_key") val publicKey: String,
@ColumnInfo(name = "encrypted_brain_key") val encryptedBrainKey: String,
@ColumnInfo(name = "sequence_number") val sequenceNumber: Long
)