contribution

package
v0.1.0-rc4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OrderByCount

func OrderByCount(in []HistogramByCountRow) sort.Interface

func OrderByFrequency

func OrderByFrequency(in []HistogramByCountRow) sort.Interface

Types

type HeatMap

type HeatMap map[time.Time]int

HeatMap contains how many contributions have been made in a time.

func (HeatMap) Count

func (chm HeatMap) Count(ts time.Time) int

Count returns how many contributions have been made in the specified time.

func (HeatMap) Diff

func (chm HeatMap) Diff(src HeatMap) HeatMap

Diff calculates the difference between two heatmaps.

func (HeatMap) From

func (chm HeatMap) From() time.Time

From returns minimum time of the heatmap, otherwise the zero time instant.

func (HeatMap) Range

func (chm HeatMap) Range() time.Range

Range returns time range of the heatmap, otherwise the zero time range instant.

func (HeatMap) SetCount

func (chm HeatMap) SetCount(ts time.Time, count int)

SetCount sets how many contributions have been made to the specified time.

func (HeatMap) Subset

func (chm HeatMap) Subset(scope time.Range) HeatMap

Subset returns a subset of contribution heatmap in the provided time range.

func (HeatMap) To

func (chm HeatMap) To() time.Time

To returns maximum time of the heatmap, otherwise the zero time instant.

type HistogramByCountRow

type HistogramByCountRow struct {
	Count, Frequency int
}

func HistogramByCount

func HistogramByCount(chm HeatMap, order ...func([]hbc) sort.Interface) []HistogramByCountRow

HistogramByCount returns the distribution of amount contributions. The first value is an amount, and the second is a frequency. The result is sorted by the first value.

1 #
3 #####
4 ##
7 ###

type HistogramByDateRow

type HistogramByDateRow struct {
	Date string
	Sum  int
}

func HistogramByDate

func HistogramByDate(chm HeatMap, format string) []HistogramByDateRow

HistogramByDate returns the sum of the number of contributions grouped by date. The first value is a date in the specified format, and the second is a sum. The result is sorted by the first value.

format: time.RFC3339Day
	2022-01-02 #
	2022-01-04 ###
	2022-01-05 ##
	2022-02-01 #

format: time.RFC3339Month
	2022-01    ######
	2022-02    #

type HistogramByWeekdayRow

type HistogramByWeekdayRow struct {
	Day time.Time
	Sum int
}

func HistogramByWeekday

func HistogramByWeekday(chm HeatMap, grouped bool) []HistogramByWeekdayRow

HistogramByWeekday returns the sum of the number of contributions grouped by day of week. The first value is a date in the specified format, and the second is a sum. The result is sorted by the first value.

grouped: false
	Monday  #
	Tuesday ###
	Friday  ##
	Monday  #

grouped: true
	Monday  ##
	Tuesday ###
	Friday  ##

Jump to

Keyboard shortcuts

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