2018-01-15 20:30:52 +00:00
|
|
|
package org.schabi.newpipe.database.playlist.dao;
|
|
|
|
|
2019-10-04 12:59:08 +00:00
|
|
|
import androidx.room.Dao;
|
|
|
|
import androidx.room.Query;
|
2018-01-15 20:30:52 +00:00
|
|
|
|
|
|
|
import org.schabi.newpipe.database.BasicDAO;
|
|
|
|
import org.schabi.newpipe.database.playlist.model.PlaylistEntity;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
2020-10-31 20:55:45 +00:00
|
|
|
import io.reactivex.rxjava3.core.Flowable;
|
2018-01-15 20:30:52 +00:00
|
|
|
|
|
|
|
import static org.schabi.newpipe.database.playlist.model.PlaylistEntity.PLAYLIST_ID;
|
|
|
|
import static org.schabi.newpipe.database.playlist.model.PlaylistEntity.PLAYLIST_TABLE;
|
|
|
|
|
|
|
|
@Dao
|
2021-01-20 00:59:50 +00:00
|
|
|
public interface PlaylistDAO extends BasicDAO<PlaylistEntity> {
|
2018-01-15 20:30:52 +00:00
|
|
|
@Override
|
|
|
|
@Query("SELECT * FROM " + PLAYLIST_TABLE)
|
2021-01-20 00:59:50 +00:00
|
|
|
Flowable<List<PlaylistEntity>> getAll();
|
2018-01-15 20:30:52 +00:00
|
|
|
|
|
|
|
@Override
|
|
|
|
@Query("DELETE FROM " + PLAYLIST_TABLE)
|
2021-01-20 00:59:50 +00:00
|
|
|
int deleteAll();
|
2018-01-15 20:30:52 +00:00
|
|
|
|
|
|
|
@Override
|
2021-01-20 00:59:50 +00:00
|
|
|
default Flowable<List<PlaylistEntity>> listByService(final int serviceId) {
|
2018-01-15 20:30:52 +00:00
|
|
|
throw new UnsupportedOperationException();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Query("SELECT * FROM " + PLAYLIST_TABLE + " WHERE " + PLAYLIST_ID + " = :playlistId")
|
2021-01-20 00:59:50 +00:00
|
|
|
Flowable<List<PlaylistEntity>> getPlaylist(long playlistId);
|
2018-01-17 05:12:03 +00:00
|
|
|
|
|
|
|
@Query("DELETE FROM " + PLAYLIST_TABLE + " WHERE " + PLAYLIST_ID + " = :playlistId")
|
2021-01-20 00:59:50 +00:00
|
|
|
int deletePlaylist(long playlistId);
|
2020-09-28 22:32:24 +00:00
|
|
|
|
|
|
|
@Query("SELECT COUNT(*) FROM " + PLAYLIST_TABLE)
|
2021-01-20 00:59:50 +00:00
|
|
|
Flowable<Long> getCount();
|
2018-01-15 20:30:52 +00:00
|
|
|
}
|