track

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package track records RTK filter statistics in a SQLite database.

Schema mirrors RTK's Rust implementation at rtk/src/core/tracking.rs. Database lives at ~/.local/share/rtk/history.db.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB holds an open connection to the history database.

func Open

func Open() (*DB, error)

Open opens (creating if necessary) the default history database at ~/.local/share/rtk/history.db.

func OpenPath

func OpenPath(path string) (*DB, error)

OpenPath opens the database at path (use ":memory:" for tests).

func (*DB) Close

func (d *DB) Close() error

Close closes the database connection.

func (*DB) Gain

func (d *DB) Gain() (totalOrig, totalFiltered, rows int, err error)

Gain returns aggregate savings statistics across all recorded filter applications.

func (*DB) Record

func (d *DB) Record(r Row) error

Record persists one filter application to the database.

type Row

type Row struct {
	Command       string
	OriginalBytes int
	FilteredBytes int
	SavedBytes    int
	SavedPct      float64
	RecordedAt    time.Time
}

Row is one recorded RTK filter application.

Jump to

Keyboard shortcuts

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