Documentation
¶
Index ¶
- func CreateDeckFromDir(dirPath string) (*model.Deck, error)
- func GetDummyDecks() []model.Deck
- func ImportMarkdownToDeck(dirPath string, deck *model.Deck) error
- func SanitizeFilename(name string) string
- func ScanDirForMarkdown(dirPath string) ([]string, error)
- func UpdateCardFile(card model.Card) error
- func WriteCard(card model.Card, path string) error
- func WriteDeckToMarkdown(deck *model.Deck, dirPath string) error
- func WriteMarkdownCard(mc *MarkdownCard, path string) error
- func WriteNewDeck(deck *model.Deck) error
- type FrontMatter
- type MarkdownCard
- type Store
- func (s *Store) GetDeck(id string) (model.Deck, bool)
- func (s *Store) GetDecks() []model.Deck
- func (s *Store) GetDueCards() []model.Card
- func (s *Store) GetDueCardsForDeck(deckID string) []model.Card
- func (s *Store) SaveCardReview(card model.Card, rating int) bool
- func (s *Store) SaveDeckToMarkdown(deckID string) error
- func (s *Store) UpdateCard(updatedCard model.Card) bool
- func (s *Store) UpdateDeckLastStudied(deckID string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDeckFromDir ¶
CreateDeckFromDir creates a new deck from a directory of markdown files
func ImportMarkdownToDeck ¶
ImportMarkdownToDeck imports markdown files into an existing deck
func SanitizeFilename ¶
SanitizeFilename converts a string to a Unix-friendly filename
func ScanDirForMarkdown ¶
ScanDirForMarkdown scans a directory for markdown files
func UpdateCardFile ¶
UpdateCardFile updates an existing markdown file with modified card data
func WriteDeckToMarkdown ¶
WriteDeckToMarkdown writes all cards in a deck to markdown files
func WriteMarkdownCard ¶
func WriteMarkdownCard(mc *MarkdownCard, path string) error
WriteMarkdownCard writes a MarkdownCard to a file
func WriteNewDeck ¶
WriteNewDeck creates a new deck directory and writes all cards as markdown files
Types ¶
type FrontMatter ¶
type FrontMatter struct {
Tags []string `yaml:"tags"`
Created time.Time `yaml:"created"`
LastReviewed time.Time `yaml:"last_reviewed"`
ReviewInterval int `yaml:"review_interval"`
Difficulty float64 `yaml:"difficulty"`
}
FrontMatter represents the YAML frontmatter in a markdown file
type MarkdownCard ¶
type MarkdownCard struct {
Path string
FrontMatter FrontMatter
Question string
Answer string
}
MarkdownCard represents a card in markdown format
func CardToMarkdown ¶
func CardToMarkdown(card model.Card) *MarkdownCard
CardToMarkdown converts a model.Card to a MarkdownCard
func ParseMarkdownFile ¶
func ParseMarkdownFile(path string) (*MarkdownCard, error)
ParseMarkdownFile parses a markdown file into a MarkdownCard
func (*MarkdownCard) ToModelCard ¶
func (mc *MarkdownCard) ToModelCard(deckID string) model.Card
ToModelCard converts a MarkdownCard to a model.Card
type Store ¶
Store manages all data for the application
func NewStoreFromDir ¶
NewStoreFromDir creates a new data store with decks from the specified directory
func (*Store) GetDueCards ¶
GetDueCards returns cards due for review
func (*Store) GetDueCardsForDeck ¶
GetDueCardsForDeck returns cards due for review in a specific deck
func (*Store) SaveCardReview ¶
SaveCardReview updates a card with its new review data and updates the parent deck's LastStudied timestamp
func (*Store) SaveDeckToMarkdown ¶
SaveDeckToMarkdown saves SRS metadata for all cards in a deck back to their markdown files
func (*Store) UpdateCard ¶
UpdateCard updates a card in the store and returns whether it was found
func (*Store) UpdateDeckLastStudied ¶
UpdateDeckLastStudied updates the LastStudied timestamp for a deck