Created
April 4, 2018 09:03
-
-
Save YousufSohail/3d8267379b15fd34968445fda606175c to your computer and use it in GitHub Desktop.
Use Dao inheritance to reduce the amount of boilerplate code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.folio3.dotnline.common.data.source.local | |
import android.arch.persistence.room.Delete | |
import android.arch.persistence.room.Insert | |
import android.arch.persistence.room.Update | |
/** | |
* Created by Yousuf Sohail on 4/4/18. | |
*/ | |
interface BaseDao<T> { | |
/** | |
* Insert an object in the database. | |
* | |
* @param obj the object to be inserted. | |
*/ | |
@Insert | |
fun insert(obj: T) | |
/** | |
* Insert an array of objects in the database. | |
* | |
* @param obj the objects to be inserted. | |
*/ | |
@Insert | |
fun insert(vararg obj: T) | |
/** | |
* Update an object from the database. | |
* | |
* @param obj the object to be updated | |
*/ | |
@Update | |
fun update(obj: T) | |
/** | |
* Delete an object from the database | |
* | |
* @param obj the object to be deleted | |
*/ | |
@Delete | |
fun delete(obj: T) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment