You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
834 B

package mappers
import (
"fmt"
c "repodiff/constants"
e "repodiff/entities"
)
func CommitCSVHeader() []string {
return []string{
"Date",
"Commit",
"Downstream Project",
"Author",
"Subject",
"Project Type",
}
}
func CommitEntityToCSVRow(a e.AnalyzedCommitRow) []string {
return quoteAll(
[]string{
a.Date,
a.Commit,
a.DownstreamProject,
a.Author,
a.Subject,
c.ProjectTypeToDisplay[a.Type],
},
)
}
func CommitEntitiesToCSVRows(commits []e.AnalyzedCommitRow) [][]string {
rowsOfCols := make([][]string, len(commits))
for i, commit := range commits {
cols := CommitEntityToCSVRow(commit)
rowsOfCols[i] = cols
}
return rowsOfCols
}
func quoteAll(s []string) []string {
copied := make([]string, len(s))
for i, val := range s {
copied[i] = fmt.Sprintf("%q", val)
}
return copied
}