MIgrate BaseDao to kotlin

This commit is contained in:
Shinokuni 2021-09-02 13:36:02 +02:00
parent 85042e5d3c
commit c2110b08c9
2 changed files with 33 additions and 36 deletions

View File

@ -1,36 +0,0 @@
package com.readrops.db.dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Update;
import java.util.List;
import io.reactivex.Completable;
import io.reactivex.Single;
public interface BaseDao<T> {
@Insert
Single<Long> insert(T entity);
// only here for compatibility with LocalFeedRepository
// which hasn't been written with rxjava usage in mind
@Insert
long compatInsert(T entity);
@Insert
List<Long> insert(List<T> entities);
@Update
Completable update(T entity);
@Update
Completable update(List<T> entities);
@Delete
Completable delete(T entity);
@Delete
Completable delete(List<T> entities);
}

View File

@ -0,0 +1,33 @@
package com.readrops.db.dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.Update
import io.reactivex.Completable
import io.reactivex.Single
interface BaseDao<T> {
@Insert
fun insert(entity: T): Single<Long>
// only here for compatibility with LocalFeedRepository
// which hasn't been written with rxjava usage in mind
@Insert
fun compatInsert(entity: T): Long
@Insert
fun insert(entities: List<T>?): List<Long>
@Update
fun update(entity: T): Completable
@Update
fun update(entities: List<T>?): Completable
@Delete
fun delete(entity: T): Completable
@Delete
fun delete(entities: List<T>?): Completable
}