database

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Historyy fileOption = iota
	Config
	Stats
)

Variables

This section is empty.

Functions

func FileExists added in v0.1.1

func FileExists(filename string) bool

func GetPath added in v0.1.1

func GetPath(option fileOption) (string, error)

func Save

func Save(test TestResult) error

Save saves test result to $CONFIG_PATH/couik/history.json

Types

type History

type History []TestResult

func GetHistory

func GetHistory() (History, error)

GetHistory retrieves the history of your typing tests

type Language added in v0.1.1

type Language int

Language category

const (
	French Language = iota
	English
)

type Quote added in v0.1.1

type Quote struct {
	Text   string `json:"text"`
	Source string `json:"source"`
	Length int    `json:"length"`
}

func GetQuotes added in v0.1.1

func GetQuotes(lang Language, category QuoteCategory) []Quote

GetQuotes loads quotes the embedded data and returns a list of quotes according to the language and category

type QuoteCategory added in v0.1.3

type QuoteCategory int
const (
	Small QuoteCategory = iota
	Mid
	Thicc
)

type TestResult

type TestResult struct {
	RawWPM   float64       `json:"raw_wpm"`
	WPM      float64       `json:"wpm"`
	Acc      float64       `json:"accuracy"`
	Duration time.Duration `json:"duration"`
	Date     time.Time     `json:"date"`
	Quote    string        `json:"quote"`
}

type TypingData added in v0.1.1

type TypingData struct {
	Language string  `json:"language"`
	Quotes   []Quote `json:"quotes"`
}

func LoadEmbeddedQuotes added in v0.1.1

func LoadEmbeddedQuotes(lang Language) TypingData

LoadEmbeddedQuotes loads data from json files according to the language (english and french for now)

Jump to

Keyboard shortcuts

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