Add new queries: update, delete, insert

Change-Id: Iae763a3efc8a00c7ffda252b2d9f8d9f2bf3667b
pull/1268/head
Jaehwa Noh 2 days ago
parent ade8065442
commit 180dbe4c31

@ -31,6 +31,43 @@ interface TopicFtsDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertAll(topics: List<TopicFtsEntity>)
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insert(topic: TopicFtsEntity)
@Query(
"""
DELETE
FROM topicsFts
WHERE topicId = :topicId
""",
)
suspend fun deleteById(topicId: String)
@Query(
"""
SELECT *
FROM topicsFts
WHERE topicId = :topicId
""",
)
suspend fun getFtsEntityById(topicId: String): List<TopicFtsEntity>
@Query(
"""
UPDATE topicsFts
SET name = :name,
shortDescription = :shortDescription,
longDescription = :longDescription
WHERE topicId = :topicId
""",
)
suspend fun update(
name: String,
shortDescription: String,
longDescription: String,
topicId: String,
)
@Query("SELECT topicId FROM topicsFts WHERE topicsFts MATCH :query")
fun searchAllTopics(query: String): Flow<List<String>>

Loading…
Cancel
Save