Skip to content

Commit 2fc7de4

Browse files
Factory for bookmarks repositories (#20)
* Create PageBookmarksRepositoryFactory
1 parent 592859d commit 2fc7de4

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package com.quran.shared.persistence.repository
2+
3+
import com.quran.shared.persistence.DriverFactory
4+
import com.quran.shared.persistence.makeDatabase
5+
6+
/**
7+
* Factory for creating PageBookmarksRepository instances.
8+
* This factory hides the details of database creation and provides a clean interface
9+
* for obtaining repository instances.
10+
*/
11+
class PageBookmarksRepositoryFactory {
12+
companion object {
13+
/**
14+
* Creates a new instance of PageBookmarksRepository.
15+
* The repository is backed by a SQLite database created using the provided driver factory.
16+
*
17+
* @param driverFactory The driver factory to use for database creation
18+
* @return PageBookmarksRepository A new repository instance
19+
*/
20+
fun createRepository(driverFactory: DriverFactory): PageBookmarksRepository {
21+
val database = makeDatabase(driverFactory)
22+
return PageBookmarksRepositoryImpl(database)
23+
}
24+
25+
/**
26+
* Creates a new instance of PageBookmarksSynchronizationRepository.
27+
* This repository provides synchronization-specific operations for page bookmarks.
28+
*
29+
* @param driverFactory The driver factory to use for database creation
30+
* @return PageBookmarksSynchronizationRepository A new synchronization repository instance
31+
*/
32+
fun createSynchronizationRepository(driverFactory: DriverFactory): PageBookmarksSynchronizationRepository {
33+
val database = makeDatabase(driverFactory)
34+
return PageBookmarksRepositoryImpl(database)
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)