Pagination: Learnings - devrath/ComposeAlchemy GitHub Wiki

Learnings

Difference between DTO and Entity

  • We call DTO for something that corresponds to NetworkModel.
  • We call Entity something that corresponds to Database.

What does @Upsert do

  • If the rows with an ID are not there it is added. If it is there it will just be updated.

What is a remote mediator

  • We need to get the API response and add it to the database and properly we need to paginate it as needed.
  • If we just want to paginate from the API it is simple since there will be a class to do that where we can add the implementation but if there is a API and Local-DB involved then it becomes much more complicated.
  • We can add a custom implementation or just use a remote mediator
  • Remote mediator gets the data from API and adds it to the Room-DB and gives the page that we just need at the moment.