update
This commit is contained in:
parent
32374b0961
commit
c5c9785a96
@ -9,7 +9,7 @@ interface PdfDocumentDao {
|
|||||||
|
|
||||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
suspend fun insertOrUpdate(document: PdfDocumentEntity)
|
suspend fun insertOrUpdate(document: PdfDocumentEntity)
|
||||||
|
//@Update 不会响应flow
|
||||||
@Update
|
@Update
|
||||||
suspend fun update(document: PdfDocumentEntity)
|
suspend fun update(document: PdfDocumentEntity)
|
||||||
|
|
||||||
@ -37,6 +37,7 @@ interface PdfDocumentDao {
|
|||||||
@Query("DELETE FROM pdf_documents WHERE filePath = :filePath")
|
@Query("DELETE FROM pdf_documents WHERE filePath = :filePath")
|
||||||
suspend fun deleteByPath(filePath: String)
|
suspend fun deleteByPath(filePath: String)
|
||||||
|
|
||||||
|
//@Query 会响应flow
|
||||||
@Query("UPDATE pdf_documents SET filePath = :newFilePath, fileName = :newName WHERE filePath = :oldFilePath")
|
@Query("UPDATE pdf_documents SET filePath = :newFilePath, fileName = :newName WHERE filePath = :oldFilePath")
|
||||||
suspend fun updateFilePathAndFileName(oldFilePath: String, newFilePath: String, newName: String)
|
suspend fun updateFilePathAndFileName(oldFilePath: String, newFilePath: String, newName: String)
|
||||||
|
|
||||||
|
|||||||
@ -43,13 +43,6 @@ class PdfRepository private constructor(context: Context) {
|
|||||||
pdfDao.updateFilePathAndFileName(oldFilePath, newFilePath, newName)
|
pdfDao.updateFilePathAndFileName(oldFilePath, newFilePath, newName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// suspend fun updateFilePathAndFileName(filePath: String, newFilePath: String, newName: String) {
|
|
||||||
// val document = pdfDao.getByPath(filePath)?.copy(
|
|
||||||
// filePath = newFilePath, fileName = newName
|
|
||||||
// )
|
|
||||||
// document?.let { pdfDao.update(it) }
|
|
||||||
// }
|
|
||||||
|
|
||||||
suspend fun updateFavoriteStatus(filePath: String, isFavorite: Boolean) {
|
suspend fun updateFavoriteStatus(filePath: String, isFavorite: Boolean) {
|
||||||
val document = pdfDao.getByPath(filePath)?.copy(
|
val document = pdfDao.getByPath(filePath)?.copy(
|
||||||
isFavorite = isFavorite,
|
isFavorite = isFavorite,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user