Created
December 31, 2018 08:47
-
-
Save cdsap/6e1d78d9e06f8930d036527e10d3d12c to your computer and use it in GitHub Desktop.
SyncRepositoryImpl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SyncRepositoryImpl<out T : LocalSource<E>, out R : RemoteSource<Q>, Q, E>( | |
private val db: T, | |
private val api: R, | |
private val mapper: Mapper<Q, E> | |
) : SyncRepository { | |
override fun sync() { | |
api.sync().forEach { | |
db.save(mapper.map(it)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment