viewshistory

package
v0.0.0-...-ce9b3c2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package viewshistory persists per-repo daily traffic counts so the Overview SVG can show a lifetime view total instead of GitHub's rolling 14-day window.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Save

func Save(path string, history History) error

Save writes history to path with deterministic indentation so the file produces stable diffs in git.

func Total

func Total(history History) int

Total sums the profile counter plus every recorded count across every repo and date.

Types

type History

type History struct {
	Counter int                       `json:"counter"`
	Seed    int                       `json:"seed,omitempty"`
	Repos   map[string]map[string]int `json:"repos"`
}

History is repo full-name -> ISO date string (YYYY-MM-DD) -> view count, plus the current profile-view counter value from the profile README badge.

func Load

func Load(path string) (History, error)

Load reads a History from path. If the file does not exist an empty history is returned without error.

func Merge

func Merge(history History, fresh map[string]map[string]int) History

Merge folds the latest fresh-from-GitHub daily counts into history. Each fresh count for a date overwrites the stored one (GitHub may revise recent counts as more data flows in).

Jump to

Keyboard shortcuts

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