mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
add NewDataSet call
This commit is contained in:
@@ -11,8 +11,6 @@ import (
|
|||||||
gterm "github.com/taigrr/gitgraph/term"
|
gterm "github.com/taigrr/gitgraph/term"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DataSet map[time.Time]gico.WorkDay
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
r, err := git.PlainOpenWithOptions(".", &(git.PlainOpenOptions{DetectDotGit: true}))
|
r, err := git.PlainOpenWithOptions(".", &(git.PlainOpenOptions{DetectDotGit: true}))
|
||||||
@@ -26,7 +24,7 @@ func main() {
|
|||||||
// year := time.Now().Year()
|
// year := time.Now().Year()
|
||||||
// yearStart := time.Time{}
|
// yearStart := time.Time{}
|
||||||
// yearStart.AddDate(year, 0, 0)
|
// yearStart.AddDate(year, 0, 0)
|
||||||
data := make(DataSet)
|
data := gico.NewDataSet()
|
||||||
err = cIter.ForEach(func(c *object.Commit) error {
|
err = cIter.ForEach(func(c *object.Commit) error {
|
||||||
ts := c.Author.When
|
ts := c.Author.When
|
||||||
commit := gico.Commit{Author: c.Author.Name, Message: c.Message, TimeStamp: ts}
|
commit := gico.Commit{Author: c.Author.Name, Message: c.Message, TimeStamp: ts}
|
||||||
|
|||||||
4
gico.go
4
gico.go
@@ -50,6 +50,10 @@ type Commit struct {
|
|||||||
|
|
||||||
type DataSet map[time.Time]WorkDay
|
type DataSet map[time.Time]WorkDay
|
||||||
|
|
||||||
|
func NewDataSet() DataSet {
|
||||||
|
return make(DataSet)
|
||||||
|
}
|
||||||
|
|
||||||
type WorkDay struct {
|
type WorkDay struct {
|
||||||
Day time.Time `json:"day"`
|
Day time.Time `json:"day"`
|
||||||
Count int `json:"count"`
|
Count int `json:"count"`
|
||||||
|
|||||||
Reference in New Issue
Block a user