trana

package module
v0.0.0-...-8f3fa7a Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: CC0-1.0 Imports: 9 Imported by: 0

README

Träna

A simple tool for practicing flashcards.

TODO

  • Tags
  • Cards with multiple backs (newline separated)
  • Decay comfort over time (configurable)

Documentation

Index

Constants

View Source
const (
	ComfortReviewMin = 1
	ComfortReviewMax = 3

	ComfortMin    = ComfortReviewMin - 1
	ComfortMax    = ComfortReviewMax + 1
	ComfortStddev = 0.25
)

Variables

View Source
var ErrBadComfort = fmt.Errorf("trana: comfort must be from %d to %d", ComfortReviewMax, ComfortReviewMax)

Functions

This section is empty.

Types

type Card

type Card struct {
	ID            int64
	Deck          int64
	Front         string
	Back          string
	LastPracticed *time.Time
	Comfort       float64
}

type Deck

type Deck struct {
	ID   int64
	Name string
}

type Trana

type Trana struct {
	// contains filtered or unexported fields
}

func New

func New(path string) (*Trana, error)

func (*Trana) Close

func (t *Trana) Close() error

func (*Trana) CreateCard

func (t *Trana) CreateCard(ctx context.Context, deck int64, front, back string) error

func (*Trana) CreateDeck

func (t *Trana) CreateDeck(ctx context.Context, name string) error

func (*Trana) DeleteCard

func (t *Trana) DeleteCard(ctx context.Context, id int64) error

func (*Trana) DeleteDeck

func (t *Trana) DeleteDeck(ctx context.Context, id int64) error

func (*Trana) GetCard

func (t *Trana) GetCard(ctx context.Context, id int64) (*Card, error)

func (*Trana) GetDeck

func (t *Trana) GetDeck(ctx context.Context, id int64) (*Deck, error)

func (*Trana) Import

func (t *Trana) Import(ctx context.Context, deck int64, cards []Card) error

func (*Trana) ListCards

func (t *Trana) ListCards(ctx context.Context, deck int64) ([]Card, error)

func (*Trana) ListDecks

func (t *Trana) ListDecks(ctx context.Context) ([]Deck, error)

func (*Trana) NextCard

func (t *Trana) NextCard(ctx context.Context, deck int64) (*Card, error)

func (*Trana) ReviewCard

func (t *Trana) ReviewCard(ctx context.Context, id int64, comfort float64) error

func (*Trana) UpdateCard

func (t *Trana) UpdateCard(ctx context.Context, card *Card) error

func (*Trana) UpdateDeck

func (t *Trana) UpdateDeck(ctx context.Context, deck *Deck) error

Directories

Path Synopsis
cmd
internal
db

Jump to

Keyboard shortcuts

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