Documentation ¶
Overview ¶
Package deck provides the model of decks containing flashcards. The user can create, edit and delete decks as well as flashcards from the deck.
Index ¶
- Variables
- type IService
- type Service
- func (s *Service) Cache() cache.Cache
- func (s *Service) DeleteDeck(ctx context.Context, userId models.UserId, deckId models.DeckId) (err error)
- func (s *Service) LoadDecks(ctx context.Context, id models.UserId) (_ models.Decks, err error)
- func (s *Service) NewDeckWithFlashcards(ctx context.Context, userId models.UserId, cfg models.DeckConfig, ...) (_ models.DeckId, err error)
- func (s *Service) UserMaxBox(ctx context.Context, uid models.UserId) (_ models.Box, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrEmptyFlashcardsSlice = fmt.Errorf("empty flashcards slice")
Functions ¶
This section is empty.
Types ¶
type IService ¶
type IService interface { // Storage is embedded to IService for accessing to db methods. // temporary solution. storage.Storage // LoadDecks loads user's decks in memory if needed and returns the decks. LoadDecks(ctx context.Context, id models.UserId) (models.Decks, error) // NewDeckWithFlashcards creates a new deck and puts all the flashcards there. // Returns id of the new deck if there's no error. NewDeckWithFlashcards(ctx context.Context, userId models.UserId, cfg models.DeckConfig, flashcards []models.Flashcard) (models.DeckId, error) // DeleteDeck deletes the whole deck from user. It doesn't remove flashcards from the deck. DeleteDeck(ctx context.Context, userId models.UserId, deckId models.DeckId) error // UserMaxBox returns the maximum amount of boxes from the user. UserMaxBox(ctx context.Context, uid models.UserId) (models.Box, error) Cache() cache.Cache }
IService is a service for configuration user decks and flashcards.
func NewService ¶
func NewService( s storage.Storage, c cache.Cache, logger *log.Logger, creq chan<- *wordmaster.WiktionaryRequest, ) IService
NewService creates a new IService creature.
type Service ¶
Service is an IService implementation.
func (*Service) DeleteDeck ¶
func (s *Service) DeleteDeck(ctx context.Context, userId models.UserId, deckId models.DeckId) (err error)
DeleteDeck deletes the whole deck from user. It doesn't remove flashcards from the deck.
Click to show internal directories.
Click to hide internal directories.