Class GameRepository


  • public class GameRepository
    extends Object
    GameRepository contains methods that provide a layer of abstraction above the GameDao, and allows for creation, reading, updating, and deleting of attempts.
    • Constructor Detail

      • GameRepository

        public GameRepository​(Context context)
        The constructor initializes the context, the database, and the dao.
        Parameters:
        context - The application context.
    • Method Detail

      • save

        public Completable save​(Game game)
        Creates or updates a game record in the database.
        Parameters:
        game - The Game.
        Returns:
        A Completable indicating the success or failure of the creation/update.
      • delete

        public Completable delete​(Game game)
        Deletes a scale record in the database.
        Parameters:
        game - The Game.
        Returns:
        A Completable indicating the success or failure of the deletion.
      • get

        public LiveData<Game> get​(long id)
        Returns LiveData of a game, given its id.
        Parameters:
        id - The id of the game.
        Returns:
        LiveData of a Game.