Class DeckRepository


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

      • DeckRepository

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

      • save

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

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

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