2017-08-07 13:02:30 +00:00
|
|
|
package org.schabi.newpipe.database;
|
|
|
|
|
2019-10-04 12:59:08 +00:00
|
|
|
import androidx.room.Dao;
|
|
|
|
import androidx.room.Delete;
|
|
|
|
import androidx.room.Insert;
|
|
|
|
import androidx.room.Update;
|
2017-08-07 13:02:30 +00:00
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.List;
|
|
|
|
|
2020-10-31 20:55:45 +00:00
|
|
|
import io.reactivex.rxjava3.core.Flowable;
|
2017-08-07 13:02:30 +00:00
|
|
|
|
|
|
|
@Dao
|
|
|
|
public interface BasicDAO<Entity> {
|
|
|
|
/* Inserts */
|
2022-08-05 23:39:54 +00:00
|
|
|
@Insert
|
2020-03-31 17:20:15 +00:00
|
|
|
long insert(Entity entity);
|
2017-08-07 13:02:30 +00:00
|
|
|
|
2022-08-05 23:39:54 +00:00
|
|
|
@Insert
|
2020-03-31 17:20:15 +00:00
|
|
|
List<Long> insertAll(Collection<Entity> entities);
|
2017-08-07 13:02:30 +00:00
|
|
|
|
|
|
|
/* Searches */
|
2017-09-03 06:04:18 +00:00
|
|
|
Flowable<List<Entity>> getAll();
|
2017-08-07 13:02:30 +00:00
|
|
|
|
|
|
|
Flowable<List<Entity>> listByService(int serviceId);
|
|
|
|
|
|
|
|
/* Deletes */
|
|
|
|
@Delete
|
2020-03-31 17:20:15 +00:00
|
|
|
void delete(Entity entity);
|
2017-08-07 13:02:30 +00:00
|
|
|
|
2017-08-12 04:50:25 +00:00
|
|
|
int deleteAll();
|
|
|
|
|
2017-08-07 13:02:30 +00:00
|
|
|
/* Updates */
|
|
|
|
@Update
|
2020-03-31 17:20:15 +00:00
|
|
|
int update(Entity entity);
|
2017-08-07 13:02:30 +00:00
|
|
|
|
|
|
|
@Update
|
2020-03-31 17:20:15 +00:00
|
|
|
void update(Collection<Entity> entities);
|
2017-08-07 13:02:30 +00:00
|
|
|
}
|