Documentation
¶
Overview ¶
Package study provides the services for testing and studying flashcards according to Leitner's system.
There are three modules: text generation, flashcards learning and exercises with flashcards.
Index ¶
- Constants
- Variables
- type IPalmService
- type IStudyService
- type Service
- func (s *Service) ConvertIdsToCards(ctx context.Context, uid models.UserId, down models.CoolDown, n int, ...) ([]models.FlashcardId, error)
- func (s *Service) GetNextRandom(ctx context.Context, uid models.UserId, down models.CoolDown) (models.FlashcardId, error)
- func (s *Service) GetNextRandomDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown) (models.FlashcardId, error)
- func (s *Service) GetNextRandomDeckN(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, ...) ([]models.FlashcardId, error)
- func (s *Service) GetNextRandomN(ctx context.Context, uid models.UserId, down models.CoolDown, n int) ([]models.FlashcardId, error)
- func (s *Service) MakeMatching(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Matching, error)
- func (s *Service) MakeMatchingBase(ctx context.Context, cardIds []models.FlashcardId) (models.Matching, error)
- func (s *Service) MakeMatchingDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, ...) (models.Matching, error)
- func (s *Service) MakeText(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Text, error)
- func (s *Service) MakeTextBase(ctx context.Context, cardIds []models.FlashcardId) (models.Text, error)
- func (s *Service) MakeTextDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, ...) (models.Text, error)
- func (s *Service) Rate(ctx context.Context, uid models.UserId, id models.FlashcardId, ...) error
Constants ¶
const ( Bad = models.Mark(iota) Satisfactory Excellent )
Variables ¶
var ErrCardsAmt = fmt.Errorf("wrong amount of cards returned")
var ErrNoCards = fmt.Errorf("no cards")
Functions ¶
This section is empty.
Types ¶
type IPalmService ¶
type IStudyService ¶
type IStudyService interface { // GetNextRandom returns a random card from the entire set of user cards with expired CoolDown. GetNextRandom(ctx context.Context, uid models.UserId, down models.CoolDown) (models.FlashcardId, error) // GetNextRandomN returns at most n random card from the entire set of user cards with expired CoolDown. GetNextRandomN(ctx context.Context, uid models.UserId, down models.CoolDown, n int) ([]models.FlashcardId, error) // GetNextRandomDeck returns a random card from the user's deck with expired CoolDown. GetNextRandomDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown) (models.FlashcardId, error) // GetNextRandomDeckN returns at most n random cards from the user's deck with expired CoolDown. GetNextRandomDeckN(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, n int) ([]models.FlashcardId, error) // Rate moves the card into the box relative to the mark. Rate(ctx context.Context, uid models.UserId, id models.FlashcardId, mark models.Mark) error // MakeMatching returns a matching comprised from words from the entire set of user cards with expired CoolDown. MakeMatching(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Matching, error) // MakeMatchingDeck returns a matching comprised from words from the given deck with cards with expired CoolDown. MakeMatchingDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, size int) (models.Matching, error) // MakeText returns a text generated by a ***AI_SERVICE_NAME*** from the entire set of user cards with expired CoolDown. MakeText(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Text, error) // MakeTextDeck returns a text generated by a ***AI_SERVICE_NAME*** from the given deck with cards with expired CoolDown. MakeTextDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, size int) (models.Text, error) }
func NewService ¶
func NewService(s deck.IService) IStudyService
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) ConvertIdsToCards ¶
func (*Service) GetNextRandom ¶
func (s *Service) GetNextRandom(ctx context.Context, uid models.UserId, down models.CoolDown) (models.FlashcardId, error)
GetNextRandom returns a random card from the entire set of user cards with expired CoolDown.
func (*Service) GetNextRandomDeck ¶
func (s *Service) GetNextRandomDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown) (models.FlashcardId, error)
GetNextRandomDeck returns at most n random card from the entire set of user cards with expired CoolDown.
func (*Service) GetNextRandomDeckN ¶
func (s *Service) GetNextRandomDeckN(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, n int) ([]models.FlashcardId, error)
GetNextRandomDeckN returns at most n random cards from the user's deck with expired CoolDown.
func (*Service) GetNextRandomN ¶
func (s *Service) GetNextRandomN(ctx context.Context, uid models.UserId, down models.CoolDown, n int) ([]models.FlashcardId, error)
GetNextRandomN returns at most n random card from the entire set of user cards with expired CoolDown.
func (*Service) MakeMatching ¶
func (s *Service) MakeMatching(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Matching, error)
MakeMatching returns a matching comprised from words from the entire set of user cards with expired CoolDown.
func (*Service) MakeMatchingBase ¶
func (s *Service) MakeMatchingBase(ctx context.Context, cardIds []models.FlashcardId) (models.Matching, error)
Creates a matching from the given cardIds
func (*Service) MakeMatchingDeck ¶
func (s *Service) MakeMatchingDeck(ctx context.Context, uid models.UserId, id models.DeckId, down models.CoolDown, size int) (models.Matching, error)
MakeMatchingDeck returns a matching comprised from words from the given deck with cards with expired CoolDown.
func (*Service) MakeText ¶
func (s *Service) MakeText(ctx context.Context, uid models.UserId, down models.CoolDown, size int) (models.Text, error)
MakeText returns a text generated by a ***AI_SERVICE_NAME*** from the entire set of user cards with expired CoolDown.
func (*Service) MakeTextBase ¶
func (s *Service) MakeTextBase(ctx context.Context, cardIds []models.FlashcardId) (models.Text, error)
Creates the text from the given cardIds