Newer
Older
LeftoverRecipe / app / src / main / kotlin / org / ntlab / leftoverrecipe / model / db / RecipeDataRealm.kt
MatsumotoKeiju on 9 Jul 2017 437 bytes [add] LeftoverRecipe Project
package org.ntlab.leftoverrecipe.model.db

import io.realm.Realm

/**
 * Created by matsumoto_k on 2017/07/06.
 */
object RecipeDataRealm : RealmBase() {
    var mRealm: Realm? = null

    fun insert(recipeData: RecipeData) {
        mRealm = Realm.getInstance(config)
        mRealm.use {
            realm ->
            realm?.executeTransaction {
                realm?.copyToRealmOrUpdate(recipeData)
            }
        }
    }
}