From 2ab89996389b6beb8fa2b806ac4cfc5fa5f68890 Mon Sep 17 00:00:00 2001 From: r-ca Date: Thu, 14 Dec 2023 04:08:01 +0900 Subject: [PATCH] =?UTF-8?q?TagDao:=20Insert,=20Update,=20Delete=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lacerta/source/database/dao/TagDao.java | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java index a7655dab..5209be6e 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/TagDao.java @@ -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 findByIds(List ids); - // WIP - // TODO-rca: Insert, Update, Delete + // Insert + @Insert + void insert(Tag tag); + + @Insert + void insertAll(Tag... tags); + + @Insert + void insertAll(List tags); + + // Update + @Update + void update(Tag tag); + + @Update + void updateAll(Tag... tags); + + @Update + void updateAll(List tags); + + // Delete + @Delete + void delete(Tag tag); + + @Delete + void deleteAll(Tag... tags); + + @Delete + void deleteAll(List tags); + + @Delete + void deleteById(String id); + }