From 8f118b7067bab6f0f951f5882fee12ee827a4fb2 Mon Sep 17 00:00:00 2001 From: r-ca Date: Thu, 14 Dec 2023 04:06:54 +0900 Subject: [PATCH] =?UTF-8?q?DocumentDao:=20Insert,=20Update,=20Delete?= =?UTF-8?q?=E5=AE=9F=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/database/dao/DocumentDao.java | 41 +++++++++++++++++-- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java index ab875d3a..60fefe18 100644 --- a/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.java +++ b/source/src/main/java/one/nem/lacerta/source/database/dao/DocumentDao.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; @@ -11,6 +14,8 @@ import one.nem.lacerta.source.database.entity.Document; @Dao public interface DocumentDao { + // Select + @Query("SELECT * FROM document WHERE id = :id") Document findById(String id); @@ -18,10 +23,40 @@ public interface DocumentDao { List findAll(); @Query("SELECT * FROM document WHERE id IN (:ids)") - List findByIds(List ids); - // WIP - // TODO-rca: Insert, Update, Delete + // Insert + @Insert + void insert(Document document); + + @Insert + void insertAll(Document... documents); + + @Insert + void insertAll(List documents); + + // Update + + @Update + void update(Document document); + + @Update + void updateAll(Document... documents); + + @Update + void updateAll(List documents); + + // Delete + @Delete + void delete(Document document); + + @Delete + void deleteAll(Document... documents); + + @Delete + void deleteAll(List documents); + + @Delete + void deleteById(String id); }