refactor Author type

This commit is contained in:
2023-02-18 17:56:49 -08:00
parent b482a11999
commit ecc3163d28
4 changed files with 55 additions and 7 deletions

View File

@@ -10,10 +10,10 @@ func NewDataSet() DataSet {
return make(DataSet)
}
func NewCommit(Author, Message, Repo, Path string, Added, Deleted, FilesChanged int) Commit {
func NewCommit(AuthorName, AuthorEmail, Message, Repo, Path string, Added, Deleted, FilesChanged int) Commit {
ci := Commit{
Message: Message, Added: Added, Deleted: Deleted,
Author: Author, FilesChanged: FilesChanged, TimeStamp: time.Now(),
Author: Author{Name: AuthorName, Email: AuthorEmail}, FilesChanged: FilesChanged, TimeStamp: time.Now(),
Repo: Repo, Path: Path,
}
return ci

View File

@@ -8,6 +8,10 @@ import (
type (
Month string
Author struct {
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
}
Commit struct {
Deleted int `json:"deleted,omitempty"`
Added int `json:"added,omitempty"`
@@ -15,7 +19,7 @@ type (
Message string `json:"message,omitempty"`
Hash string `json:"hash,omitempty"`
TimeStamp time.Time `json:"ts,omitempty"`
Author string `json:"author,omitempty"`
Author Author `json:"author,omitempty"`
Repo string `json:"repo,omitempty"`
Path string `json:"path,omitempty"`
}