DocumentDao: Insert, Update, Delete実装

This commit is contained in:
r-ca 2023-12-14 04:06:54 +09:00
parent 8a0b6bd3db
commit 8f118b7067
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;
@ -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<Document> findAll();
@Query("SELECT * FROM document WHERE id IN (:ids)")
List<Document> findByIds(List<String> ids);
// WIP
// TODO-rca: Insert, Update, Delete
// Insert
@Insert
void insert(Document document);
@Insert
void insertAll(Document... documents);
@Insert
void insertAll(List<Document> documents);
// Update
@Update
void update(Document document);
@Update
void updateAll(Document... documents);
@Update
void updateAll(List<Document> documents);
// Delete
@Delete
void delete(Document document);
@Delete
void deleteAll(Document... documents);
@Delete
void deleteAll(List<Document> documents);
@Delete
void deleteById(String id);
}