Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API access for data in the LocalChangeEntity table #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions engine/src/main/java/com/google/android/fhir/FhirEngine.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ interface FhirEngine {
*/
suspend fun getLocalChanges(type: ResourceType, id: String): List<LocalChange>

suspend fun getUnsyncedLocalChanges(): List<LocalChange>

/**
* Purges a resource from the database without deleting data from the server.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ internal class FhirEngineImpl(private val database: Database, private val contex
override suspend fun getLocalChanges(type: ResourceType, id: String) =
withContext(Dispatchers.IO) { database.getLocalChanges(type, id) }

override suspend fun getUnsyncedLocalChanges(): List<LocalChange> = database.getAllLocalChanges()

override suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean) =
withContext(Dispatchers.IO) { database.purge(type, setOf(id), forcePurge) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ internal object TestFhirEngineImpl : FhirEngine {
)
}

override suspend fun getUnsyncedLocalChanges(): List<LocalChange> = listOf()

override suspend fun purge(type: ResourceType, id: String, forcePurge: Boolean) {}

override suspend fun purge(type: ResourceType, ids: Set<String>, forcePurge: Boolean) {}
Expand Down
Loading