Continue converting ArticlesDatabase to async/await.

This commit is contained in:
Brent Simmons
2023-10-01 13:15:18 -07:00
parent d419aac947
commit ad6b00a6d5
3 changed files with 19 additions and 5 deletions

View File

@@ -160,8 +160,8 @@ public typealias ArticleStatusesResultBlock = (ArticleStatusesResult) -> Void
try await articlesTable.starredArticlesForFeedIDs(feedIDs, limit)
}
public func fetchArticlesMatchingAsync(_ searchString: String, _ feedIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
articlesTable.fetchArticlesMatchingAsync(searchString, feedIDs, completion)
public func articlesForSearchStringInFeeds(_ searchString: String, _ feedIDs: Set<String>) async throws -> Set<Article> {
try await articlesTable.articleForSearchStringInFeeds(searchString, feedIDs)
}
public func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {

View File

@@ -149,8 +149,8 @@ final class ArticlesTable: DatabaseTable {
return articles
}
func fetchArticlesMatchingAsync(_ searchString: String, _ feedIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {
fetchArticlesAsync({ self.fetchArticlesMatching(searchString, feedIDs, $0) }, completion)
func articleForSearchStringInFeeds(_ searchString: String, _ feedIDs: Set<String>) async throws -> Set<Article> {
try await articlesWithFetchMethod { self.fetchArticlesMatching(searchString, feedIDs, $0) }
}
func fetchArticlesMatchingWithArticleIDsAsync(_ searchString: String, _ articleIDs: Set<String>, _ completion: @escaping ArticleSetResultBlock) {