move types to types package

This commit is contained in:
2023-01-28 00:39:27 -08:00
parent c4a74123ef
commit dcf43adf95
3 changed files with 43 additions and 45 deletions

View File

@@ -2,6 +2,8 @@ package types
import (
"time"
gterm "github.com/taigrr/gico/gitgraph/term"
)
func NewDataSet() DataSet {
@@ -9,10 +11,27 @@ func NewDataSet() DataSet {
}
func NewCommit(Author, Message, Repo, Path string, LOC int) Commit {
ci := Commit{
return Commit{
Message: Message,
Author: Author, LOC: LOC, TimeStamp: time.Now(),
Repo: Repo, Path: Path,
}
return ci
}
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
}