mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
38 lines
582 B
Go
38 lines
582 B
Go
package types
|
|
|
|
import (
|
|
"time"
|
|
|
|
gterm "github.com/taigrr/gico/graph/term"
|
|
)
|
|
|
|
func NewDataSet() DataSet {
|
|
return make(DataSet)
|
|
}
|
|
|
|
func NewCommit(Author, Message, Repo, Path string, LOC int) Commit {
|
|
return Commit{
|
|
Message: Message,
|
|
Author: Author, LOC: LOC, TimeStamp: time.Now(),
|
|
Repo: Repo, Path: Path,
|
|
}
|
|
}
|
|
|
|
func (yf YearFreq) String() string {
|
|
return gterm.GetYearUnicode(yf)
|
|
}
|
|
|
|
func (a YearFreq) Merge(b YearFreq) YearFreq {
|
|
x := len(a)
|
|
y := len(b)
|
|
if x < y {
|
|
x = y
|
|
}
|
|
c := make(YearFreq, x)
|
|
copy(c, a)
|
|
for i := 0; i < y; i++ {
|
|
c[i] += b[i]
|
|
}
|
|
return c
|
|
}
|