db

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB

Functions

func CloseDB

func CloseDB()

CloseDB closes database connection.

func GetDBFilePath

func GetDBFilePath() (string, error)

GetDBFilePath returns path to ~/.config/jeeratype/stats.db with permission fallback.

func GetFileOffset added in v1.0.2

func GetFileOffset(filePath string) int

GetFileOffset retrieves saved reading offset for a file.

func GetKeyMetrics

func GetKeyMetrics() map[rune]KeyMetric

GetKeyMetrics returns map of key stats for ASCII Keyboard Heatmap rendering.

func GetPBRace added in v1.0.2

func GetPBRace(modeKey string) (float64, []float64)

GetPBRace retrieves personal best WPM and sample timeline.

func GetTopSlowestBigrams

func GetTopSlowestBigrams(limit int) []string

GetTopSlowestBigrams returns top slowest key transition pairs.

func GetTopWeakKeys

func GetTopWeakKeys(limit int) []rune

GetTopWeakKeys returns the most missed or slowest keys.

func InitDB

func InitDB() error

InitDB initializes SQLite connection and creates schema.

func RecordBigramHit

func RecordBigramHit(bigram string, latencyMs int64) error

RecordBigramHit updates count and latency for a key-to-key transition.

func RecordKeyHit

func RecordKeyHit(keyChar string, isError bool, latencyMs int64) error

RecordKeyHit updates hits, errors, and latency for a single key.

func SaveFileOffset added in v1.0.2

func SaveFileOffset(filePath string, offset int) error

SaveFileOffset records or updates file reading cursor offset.

func SavePBRace added in v1.0.2

func SavePBRace(modeKey string, wpm float64, samples []float64) error

SavePBRace records personal best WPM and 1-second sample timeline.

func SaveTestRun

func SaveTestRun(mode string, wpm, rawWPM, accuracy, consistency float64, durationSec int) error

SaveTestRun records a test session in test_runs table.

Types

type KeyMetric

type KeyMetric struct {
	Char       rune
	TotalHits  int
	ErrorCount int
	AvgLatency float64
	Accuracy   float64
}

Jump to

Keyboard shortcuts

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