Skip to content

Instantly share code, notes, and snippets.

@jonathanrz
Created November 6, 2017 23:20
Show Gist options
  • Select an option

  • Save jonathanrz/ba2039d83c8ce94248f4579d8f0f93a2 to your computer and use it in GitHub Desktop.

Select an option

Save jonathanrz/ba2039d83c8ce94248f4579d8f0f93a2 to your computer and use it in GitHub Desktop.
interface DataSource {
fun all(): List<Data>
fun save(data: Data): Boolean
}
class DataRepository(val dao: DataDao) : DataSource {
override fun all(): List<Data> = dao.all()
override fun save(data: Data): Boolean = dao.save(data) != 0L
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment