Documentation
¶
Overview ¶
Package historian turns silk's live-only tag trends into reviewable history: it records core.Tag changes into a SQLite table and answers time-range queries, so a screen that only shows the current value can be backed by a scrollable, persisted trend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Historian ¶
type Historian struct {
// contains filtered or unexported fields
}
Historian owns a SQLite handle holding a single samples table.
func NewHistorian ¶
NewHistorian opens (creating if needed) the SQLite database at dbPath and makes sure the samples table and its (tag, ts) index exist.
func (*Historian) Query ¶
Query returns tag's samples whose timestamp is in [from, to] inclusive, ordered by timestamp ascending.
func (*Historian) Record ¶
Record subscribes to each named tag and writes one row per change; the returned func unsubscribes them all. Subscribe primes each callback with the tag's current value, so recording opens with a sample of the tag's state at record-start, followed by one per subsequent change.