flashcard

package module
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 13, 2022 License: MIT Imports: 6 Imported by: 1

README

flashcard

Description

A Go package for flashcard mainipulation and learning.

⚡️ The project is in rapid stage of development, issues and critics are welcome.

Features

  • verbose API
  • sqlite as a storage; others can be added via implementing storage.CardRepo and storage.DeckRepo interfaces

Table of contents

Getting started

See the documentation for further details.

Installation
go get github.com/k1gabyt0/flashcard
Usage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card interface {
	GetDeck() Deck
	GetDomain() domain.Card

	GetWord() string
	ChangeWord(newWord string) error

	GetTranslation() string
	ChangeTranslation(newTranslation string) error

	PutInDeck(deck Deck) error
	Delete() error
}

Card describes flashcard, stored in some deck.

type Cards added in v0.1.4

type Cards []Card

Cards represent slice of cards.

func (Cards) Filter added in v0.1.4

func (c Cards) Filter(filterFunc func(Card) bool) Cards

Filter cards with passed filterFunc.

type Deck

type Deck interface {
	GetDomain() domain.Deck

	GetName() string
	Rename(newName string) error

	ListAllCards() (Cards, error)
	FilterCards(filterFunc func(domain.Card) bool) (Cards, error)

	FindCards(word, translation string) (Cards, error)
	FindCardsByWord(word string) (Cards, error)

	AddCard(word, translation string) (Card, error)

	Clear() error
}

Deck is an interface that describes all opertions that deck of flashcards can do.

type DeckManager

type DeckManager interface {
	ListAllDecks() ([]Deck, error)
	CreateDeck(name string) (Deck, error)
	FindDeckByName(name string) (Deck, error)
	FilterDecks(filterFunc func(Deck) bool) ([]Deck, error)
	DeleteDeckByName(name string) error
}

DeckManager is an interface that describes deck management.

func NewDeckManager

func NewDeckManager(service service.FlashcardService) DeckManager

NewDeckManager creates new deckManager with passed service.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL