Documentation
¶
Index ¶
- func Append(path string, res speedtest.Result) error
- func CSV(w io.Writer, records []speedtest.Result) error
- func DefaultPath() (string, error)
- func JSON(w io.Writer, records []speedtest.Result) error
- func LastN(records []speedtest.Result, n int) []speedtest.Result
- func Load(path string) ([]speedtest.Result, int, error)
- func RenderSummary(w io.Writer, s Summary, st *output.Styler)
- func Table(w io.Writer, records []speedtest.Result, total int, st *output.Styler)
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append writes the result as one JSON line to the file at path, creating parent directories and the file if needed.
func CSV ¶ added in v0.1.7
CSV writes records as CSV with a header row. Empty input writes just the header.
func DefaultPath ¶
DefaultPath returns the default history file location under the user's home.
func JSON ¶ added in v0.1.7
JSON writes records as a 2-space-indented JSON array. Empty input writes [].
func LastN ¶ added in v0.1.7
LastN returns the most recent n records (records are oldest-first, so the tail). n <= 0 or n >= len returns all records.
func Load ¶ added in v0.1.7
Load reads the history file at path, returning the records in file order (oldest first) and the number of malformed lines skipped. A missing file returns (nil, 0, nil); a genuine read error is returned. Parsing is best-effort: a bad line is counted and skipped, never fatal.
func RenderSummary ¶ added in v0.1.7
RenderSummary renders the avg/min/max stats block from a computed Summary.