parent
30e28e677f
commit
42c3501d54
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.core.database.dao
|
||||
|
||||
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceEntity
|
||||
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceTopicCrossRef
|
||||
import com.google.samples.apps.nowinandroid.core.database.model.PopulatedNewsResource
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface NewsResourceDaoInterface {
|
||||
fun getNewsResources(
|
||||
useFilterTopicIds: Boolean = false,
|
||||
filterTopicIds: Set<String> = emptySet(),
|
||||
useFilterNewsIds: Boolean = false,
|
||||
filterNewsIds: Set<String> = emptySet()
|
||||
): Flow<List<PopulatedNewsResource>>
|
||||
|
||||
fun getNewsResourceIds(
|
||||
useFilterTopicIds: Boolean = false,
|
||||
filterTopicIds: Set<String> = emptySet(),
|
||||
useFilterNewsIds: Boolean = false,
|
||||
filterNewsIds: Set<String> = emptySet()
|
||||
): Flow<List<String>>
|
||||
|
||||
suspend fun insertOrIgnoreNewsResources(entities: List<NewsResourceEntity>): List<Long>
|
||||
suspend fun upsertNewsResources(newsResourceEntities: List<NewsResourceEntity>)
|
||||
suspend fun insertOrIgnoreTopicCrossRefEntities(newsResourceTopicCrossReferences: List<NewsResourceTopicCrossRef>)
|
||||
suspend fun deleteNewsResources(ids: List<String>)
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.core.database.dao
|
||||
|
||||
import com.google.samples.apps.nowinandroid.core.database.model.NewsResourceFtsEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface NewsResourceFtsDaoInterface {
|
||||
suspend fun insertAll(newsResources: List<NewsResourceFtsEntity>)
|
||||
fun searchAllNewsResources(query: String): Flow<List<String>>
|
||||
fun getCount(): Flow<Int>
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.core.database.dao
|
||||
|
||||
import com.google.samples.apps.nowinandroid.core.database.model.RecentSearchQueryEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface RecentSearchQueryDaoInterface {
|
||||
fun getRecentSearchQueryEntities(limit: Int): Flow<List<RecentSearchQueryEntity>>
|
||||
suspend fun insertOrReplaceRecentSearchQuery(recentSearchQuery: RecentSearchQueryEntity)
|
||||
suspend fun clearRecentSearchQueries()
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.core.database.dao
|
||||
|
||||
import com.google.samples.apps.nowinandroid.core.database.model.TopicEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface TopicDaoInterface {
|
||||
fun getTopicEntity(topicId: String): Flow<TopicEntity>
|
||||
fun getTopicEntities(): Flow<List<TopicEntity>>
|
||||
suspend fun getOneOffTopicEntities(): List<TopicEntity>
|
||||
fun getTopicEntities(ids: Set<String>): Flow<List<TopicEntity>>
|
||||
suspend fun insertOrIgnoreTopics(topicEntities: List<TopicEntity>): List<Long>
|
||||
suspend fun upsertTopics(entities: List<TopicEntity>)
|
||||
suspend fun deleteTopics(ids: List<String>)
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2024 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.samples.apps.nowinandroid.core.database.dao
|
||||
|
||||
import com.google.samples.apps.nowinandroid.core.database.model.TopicFtsEntity
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
|
||||
interface TopicFtsDaoInterface {
|
||||
suspend fun insertAll(topics: List<TopicFtsEntity>)
|
||||
fun searchAllTopics(query: String): Flow<List<String>>
|
||||
fun getCount(): Flow<Int>
|
||||
}
|
||||
Loading…
Reference in new issue