mirror of
https://github.com/taigrr/gico.git
synced 2026-04-02 03:09:07 -07:00
add types package
This commit is contained in:
18
types/helpers.go
Normal file
18
types/helpers.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewDataSet() DataSet {
|
||||||
|
return make(DataSet)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCommit(Author, Message, Repo, Path string, LOC int) Commit {
|
||||||
|
ci := Commit{
|
||||||
|
Message: Message,
|
||||||
|
Author: Author, LOC: LOC, TimeStamp: time.Now(),
|
||||||
|
Repo: Repo, Path: Path,
|
||||||
|
}
|
||||||
|
return ci
|
||||||
|
}
|
||||||
24
types/types.go
Normal file
24
types/types.go
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Month string
|
||||||
|
|
||||||
|
type Commit struct {
|
||||||
|
LOC int `json:"loc,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
|
TimeStamp time.Time `json:"ts,omitempty"`
|
||||||
|
Author string `json:"author,omitempty"`
|
||||||
|
Repo string `json:"repo,omitempty"`
|
||||||
|
Path string `json:"path,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DataSet map[time.Time]WorkDay
|
||||||
|
|
||||||
|
type WorkDay struct {
|
||||||
|
Day time.Time `json:"day"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
Commits []Commit `json:"commits,omitempty"`
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user