TagDao: Insert, Update, Delete実装

This commit is contained in:
r-ca 2023-12-14 04:08:01 +09:00
parent 8f118b7067
commit 2ab8999638
No known key found for this signature in database
GPG Key ID: 6A72911AC73464A9

View File

@ -1,7 +1,10 @@
package one.nem.lacerta.source.database.dao;
import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;
import java.util.List;
@ -10,6 +13,8 @@ import one.nem.lacerta.source.database.entity.Tag;
@Dao
public interface TagDao {
// Select
@Query("SELECT * FROM tag WHERE id = :id")
Tag findById(String id);
@ -19,6 +24,37 @@ public interface TagDao {
@Query("SELECT * FROM tag WHERE id IN (:ids)")
List<Tag> findByIds(List<String> ids);
// WIP
// TODO-rca: Insert, Update, Delete
// Insert
@Insert
void insert(Tag tag);
@Insert
void insertAll(Tag... tags);
@Insert
void insertAll(List<Tag> tags);
// Update
@Update
void update(Tag tag);
@Update
void updateAll(Tag... tags);
@Update
void updateAll(List<Tag> tags);
// Delete
@Delete
void delete(Tag tag);
@Delete
void deleteAll(Tag... tags);
@Delete
void deleteAll(List<Tag> tags);
@Delete
void deleteById(String id);
}