storage

package
v0.0.0-...-719087c Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DeckDIR = ".mdsrs/decks"

Variables

This section is empty.

Functions

func EnsureDecksDir

func EnsureDecksDir() error

func GenerateID

func GenerateID() string

Types

type Deck

type Deck struct {
	Name    string      `json:"name"`
	Cards   []Flashcard `json:"cards"`
	DirPath string      `json:"-"`
	SRS     `json:"-"`
}

func LoadAllDecks

func LoadAllDecks() ([]*Deck, error)

func LoadDeck

func LoadDeck(deckName string) (*Deck, error)

func NewDeck

func NewDeck(name string, srsData SRS) *Deck

func (*Deck) AddOrUpdateCard

func (d *Deck) AddOrUpdateCard(card Flashcard)

func (*Deck) Save

func (d *Deck) Save() error

type Flashcard

type Flashcard struct {
	DeckID  string `json:"deckId"`
	ID      string `json:"id"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

func FindCardByID

func FindCardByID(deck *Deck, cardID string) *Flashcard

type SRS

type SRS interface {
	UpdateSRSData(deck *Deck, cardID string, outcome int)
	GetReviewCards(numCards int) []Flashcard
	SaveSRSToFile() error
	LoadSRSFromFile() error
	LoadCardsFromMarkdown(deckDir string) error
}

Jump to

Keyboard shortcuts

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