stats

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBytes

func FormatBytes(bytes int64) string

FormatBytes formats bytes to human-readable string

func FormatCount

func FormatCount(n int) string

FormatCount returns a formatted string for display

func FormatDate

func FormatDate(t time.Time) string

FormatDate formats a time.Time to the key format

func ParseDate

func ParseDate(s string) (time.Time, error)

ParseDate parses a date string

Types

type ContributionData

type ContributionData struct {
	Days         map[string]int // "2024-01-15" -> 5 commits
	TotalCommits int
	WeeksCount   int
	StartDate    time.Time
	EndDate      time.Time
	MaxDaily     int // Max commits in a single day (for scaling)
}

ContributionData holds commit counts per day for the heatmap

func GetContributions

func GetContributions(repos []model.Repo, weeks int) (*ContributionData, error)

GetContributions aggregates commits from all repos for the last N weeks

func (*ContributionData) GetDayCount

func (d *ContributionData) GetDayCount(date string) int

GetDayCount returns commit count for a specific date

func (*ContributionData) GetIntensityLevel

func (d *ContributionData) GetIntensityLevel(date string) int

GetIntensityLevel returns 0-4 based on commit count relative to max

func (*ContributionData) GetMonthLabels

func (d *ContributionData) GetMonthLabels() []string

GetMonthLabels returns month labels for the heatmap header

func (*ContributionData) GetWeeksData

func (d *ContributionData) GetWeeksData() [][]string

GetWeeksData returns contribution data organized by weeks for rendering Returns a slice of weeks, each containing 7 days (Sun-Sat)

type DiskUsageData

type DiskUsageData struct {
	Repos          []RepoDiskUsage
	TotalGitSize   int64
	TotalNodeSize  int64
	TotalSize      int64
	MaxSize        int64
	RepoCount      int
	HasNodeModules bool
}

DiskUsageData holds disk usage information for all repos

func GetDiskUsage

func GetDiskUsage(repos []model.Repo) (*DiskUsageData, error)

GetDiskUsage calculates .git and node_modules folder sizes for all repos

func (*DiskUsageData) GetBarWidth

func (d *DiskUsageData) GetBarWidth(size int64, maxWidth int) int

GetBarWidth returns the relative bar width (0-100) for a repo size

type RepoDiskUsage

type RepoDiskUsage struct {
	Name            string
	Path            string
	GitSize         int64 // Size of .git folder in bytes
	NodeModulesSize int64 // Size of node_modules folder in bytes
	TotalSize       int64 // Combined size
}

RepoDiskUsage holds disk usage for a single repo

type TimelineData

type TimelineData struct {
	Entries    []TimelineEntry
	TotalRepos int
}

TimelineData holds timeline information

func GetTimeline

func GetTimeline(repos []model.Repo) (*TimelineData, error)

GetTimeline gets recent activity timeline sorted by last commit

type TimelineEntry

type TimelineEntry struct {
	Name       string
	Path       string
	Branch     string
	LastCommit time.Time
	Message    string // Last commit message
	TimeAgo    string // Human-readable time ago
	DayLabel   string // "Today", "Yesterday", "2 days ago", etc.
}

TimelineEntry represents a repo activity entry

Jump to

Keyboard shortcuts

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