mirror of
https://github.com/lacerta-doc/Lacerta.git
synced 2024-11-26 17:53:14 +00:00
名前が紛らわしすぎたので*Entityにリネームした
This commit is contained in:
parent
c12319e103
commit
4dc68854d3
|
@ -8,10 +8,6 @@ import one.nem.lacerta.data.Document;
|
||||||
|
|
||||||
import one.nem.lacerta.model.document.DocumentMeta;
|
import one.nem.lacerta.model.document.DocumentMeta;
|
||||||
import one.nem.lacerta.model.document.DocumentDetail;
|
import one.nem.lacerta.model.document.DocumentDetail;
|
||||||
import one.nem.lacerta.model.document.path.DocumentPath;
|
|
||||||
import one.nem.lacerta.model.document.tag.DocumentTag;
|
|
||||||
|
|
||||||
import one.nem.lacerta.source.database.entity.Document;
|
|
||||||
|
|
||||||
import one.nem.lacerta.source.database.LacertaDatabase;
|
import one.nem.lacerta.source.database.LacertaDatabase;
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,16 @@ import androidx.room.Database;
|
||||||
import androidx.room.RoomDatabase;
|
import androidx.room.RoomDatabase;
|
||||||
|
|
||||||
// Entities
|
// Entities
|
||||||
import one.nem.lacerta.source.database.entity.Tag;
|
import one.nem.lacerta.source.database.entity.TagEntity;
|
||||||
import one.nem.lacerta.source.database.entity.Document;
|
import one.nem.lacerta.source.database.entity.DocumentEntity;
|
||||||
import one.nem.lacerta.source.database.entity.Library;
|
import one.nem.lacerta.source.database.entity.LibraryEntity;
|
||||||
|
|
||||||
// Daos
|
// Daos
|
||||||
import one.nem.lacerta.source.database.dao.TagDao;
|
import one.nem.lacerta.source.database.dao.TagDao;
|
||||||
import one.nem.lacerta.source.database.dao.DocumentDao;
|
import one.nem.lacerta.source.database.dao.DocumentDao;
|
||||||
import one.nem.lacerta.source.database.dao.LibraryDao;
|
import one.nem.lacerta.source.database.dao.LibraryDao;
|
||||||
|
|
||||||
@Database(entities = {Tag.class, Document.class, Library.class}, version = 1)
|
@Database(entities = {TagEntity.class, DocumentEntity.class, LibraryEntity.class}, version = 1)
|
||||||
public abstract class LacertaDatabase extends RoomDatabase {
|
public abstract class LacertaDatabase extends RoomDatabase {
|
||||||
public abstract TagDao tagDao();
|
public abstract TagDao tagDao();
|
||||||
public abstract DocumentDao documentDao();
|
public abstract DocumentDao documentDao();
|
||||||
|
|
|
@ -8,7 +8,7 @@ import androidx.room.Update;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import one.nem.lacerta.source.database.entity.Document;
|
import one.nem.lacerta.source.database.entity.DocumentEntity;
|
||||||
|
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
|
@ -16,46 +16,46 @@ public interface DocumentDao {
|
||||||
|
|
||||||
// Select
|
// Select
|
||||||
|
|
||||||
@Query("SELECT * FROM document WHERE id = :id")
|
@Query("SELECT * FROM DocumentEntity WHERE id = :id")
|
||||||
Document findById(String id);
|
DocumentEntity findById(String id);
|
||||||
|
|
||||||
@Query("SELECT * FROM document")
|
@Query("SELECT * FROM DocumentEntity")
|
||||||
List<Document> findAll();
|
List<DocumentEntity> findAll();
|
||||||
|
|
||||||
@Query("SELECT * FROM document WHERE id IN (:ids)")
|
@Query("SELECT * FROM DocumentEntity WHERE id IN (:ids)")
|
||||||
List<Document> findByIds(List<String> ids);
|
List<DocumentEntity> findByIds(List<String> ids);
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
@Insert
|
@Insert
|
||||||
void insert(Document document);
|
void insert(DocumentEntity document);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(Document... documents);
|
void insertAll(DocumentEntity... documents);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(List<Document> documents);
|
void insertAll(List<DocumentEntity> documents);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void update(Document document);
|
void update(DocumentEntity document);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void updateAll(Document... documents);
|
void updateAll(DocumentEntity... documents);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void updateAll(List<Document> documents);
|
void updateAll(List<DocumentEntity> documents);
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
@Delete
|
@Delete
|
||||||
void delete(Document document);
|
void delete(DocumentEntity document);
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
void deleteAll(Document... documents);
|
void deleteAll(DocumentEntity... documents);
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
void deleteAll(List<Document> documents);
|
void deleteAll(List<DocumentEntity> documents);
|
||||||
|
|
||||||
@Query("DELETE FROM document WHERE id = :id")
|
@Query("DELETE FROM DocumentEntity WHERE id = :id")
|
||||||
void deleteById(String id);
|
void deleteById(String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,19 +5,19 @@ import androidx.room.Query;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import one.nem.lacerta.source.database.entity.Library;
|
import one.nem.lacerta.source.database.entity.LibraryEntity;
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
public interface LibraryDao {
|
public interface LibraryDao {
|
||||||
|
|
||||||
@Query("SELECT * FROM library WHERE id = :id")
|
@Query("SELECT * FROM LibraryEntity WHERE id = :id")
|
||||||
Library findById(String id);
|
LibraryEntity findById(String id);
|
||||||
|
|
||||||
@Query("SELECT * FROM library")
|
@Query("SELECT * FROM LibraryEntity")
|
||||||
List<Library> findAll();
|
List<LibraryEntity> findAll();
|
||||||
|
|
||||||
@Query("SELECT * FROM library WHERE id IN (:ids)")
|
@Query("SELECT * FROM LibraryEntity WHERE id IN (:ids)")
|
||||||
List<Library> findByIds(List<String> ids);
|
List<LibraryEntity> findByIds(List<String> ids);
|
||||||
|
|
||||||
// WIP
|
// WIP
|
||||||
// TODO-rca: Insert, Update, Delete
|
// TODO-rca: Insert, Update, Delete
|
||||||
|
|
|
@ -8,52 +8,52 @@ import androidx.room.Update;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import one.nem.lacerta.source.database.entity.Tag;
|
import one.nem.lacerta.source.database.entity.TagEntity;
|
||||||
|
|
||||||
@Dao
|
@Dao
|
||||||
public interface TagDao {
|
public interface TagDao {
|
||||||
|
|
||||||
// Select
|
// Select
|
||||||
|
|
||||||
@Query("SELECT * FROM tag WHERE id = :id")
|
@Query("SELECT * FROM TagEntity WHERE id = :id")
|
||||||
Tag findById(String id);
|
TagEntity findById(String id);
|
||||||
|
|
||||||
@Query("SELECT * FROM tag")
|
@Query("SELECT * FROM TagEntity")
|
||||||
List<Tag> findAll();
|
List<TagEntity> findAll();
|
||||||
|
|
||||||
@Query("SELECT * FROM tag WHERE id IN (:ids)")
|
@Query("SELECT * FROM TagEntity WHERE id IN (:ids)")
|
||||||
List<Tag> findByIds(List<String> ids);
|
List<TagEntity> findByIds(List<String> ids);
|
||||||
|
|
||||||
// Insert
|
// Insert
|
||||||
@Insert
|
@Insert
|
||||||
void insert(Tag tag);
|
void insert(TagEntity tag);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(Tag... tags);
|
void insertAll(TagEntity... tags);
|
||||||
|
|
||||||
@Insert
|
@Insert
|
||||||
void insertAll(List<Tag> tags);
|
void insertAll(List<TagEntity> tags);
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
@Update
|
@Update
|
||||||
void update(Tag tag);
|
void update(TagEntity tag);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void updateAll(Tag... tags);
|
void updateAll(TagEntity... tags);
|
||||||
|
|
||||||
@Update
|
@Update
|
||||||
void updateAll(List<Tag> tags);
|
void updateAll(List<TagEntity> tags);
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
@Delete
|
@Delete
|
||||||
void delete(Tag tag);
|
void delete(TagEntity tag);
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
void deleteAll(Tag... tags);
|
void deleteAll(TagEntity... tags);
|
||||||
|
|
||||||
@Delete
|
@Delete
|
||||||
void deleteAll(List<Tag> tags);
|
void deleteAll(List<TagEntity> tags);
|
||||||
|
|
||||||
@Query("DELETE FROM tag WHERE id = :id")
|
@Query("DELETE FROM TagEntity WHERE id = :id")
|
||||||
void deleteById(String id);
|
void deleteById(String id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Date;
|
||||||
|
|
||||||
@Entity(tableName = "document")
|
@Entity(tableName = "document")
|
||||||
@TypeConverters(DateTypeConverter.class)
|
@TypeConverters(DateTypeConverter.class)
|
||||||
public class Document {
|
public class DocumentEntity {
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@ColumnInfo(name = "id")
|
@ColumnInfo(name = "id")
|
||||||
@NonNull
|
@NonNull
|
|
@ -6,7 +6,7 @@ import androidx.room.Entity;
|
||||||
import androidx.room.PrimaryKey;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
@Entity(tableName = "library")
|
@Entity(tableName = "library")
|
||||||
public class Library {
|
public class LibraryEntity {
|
||||||
|
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@ColumnInfo(name = "id")
|
@ColumnInfo(name = "id")
|
|
@ -6,7 +6,7 @@ import androidx.room.Entity;
|
||||||
import androidx.room.PrimaryKey;
|
import androidx.room.PrimaryKey;
|
||||||
|
|
||||||
@Entity(tableName = "tag")
|
@Entity(tableName = "tag")
|
||||||
public class Tag {
|
public class TagEntity {
|
||||||
|
|
||||||
@PrimaryKey
|
@PrimaryKey
|
||||||
@ColumnInfo(name = "id")
|
@ColumnInfo(name = "id")
|
Loading…
Reference in New Issue
Block a user