Documentation
¶
Overview ¶
Package history persists per-key validation records across runs so users can answer "what was the validity of this key over the last N runs?".
Records are keyed on (provider, sha256(key)) and include the run_id so a single key's history can be grouped and sorted by time.
On-disk format: ~/.kunji/history.jsonl — one JSON object per line.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByKey ¶
ByKey groups records by their (provider, key_sha256) composite key, sorted newest-first within each group.
func DefaultPath ¶
func DefaultPath() string
DefaultPath returns ~/.kunji/history.jsonl (override with KUNJI_HISTORY_FILE).
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger writes history records. A nil receiver is a no-op.
func Open ¶
Open prepares a history logger. runID should be unique per execution and is stamped on every record written by this logger.
func (*Logger) Emit ¶
func (l *Logger) Emit(r *models.ValidationResult) error
Emit writes one history record for the given validation result.
type Record ¶
type Record struct {
RunID string `json:"run_id"`
Timestamp string `json:"ts"`
Provider string `json:"provider"`
KeySHA256 string `json:"key_sha256"`
IsValid bool `json:"is_valid"`
StatusCode int `json:"status_code,omitempty"`
DurationMs int64 `json:"duration_ms,omitempty"`
}
Record is one history entry.