1package controllers
2
3import (
4	ent "repodiff/entities"
5	"repodiff/repositories"
6)
7
8type Committer interface {
9	InsertCommitRows(commitRows []ent.AnalyzedCommitRow) error
10	GetFirstSeenTimestamp(commitHashes []string, nullTimestamp ent.RepoTimestamp) (map[string]ent.RepoTimestamp, error)
11	GetMostRecentCommits() ([]ent.AnalyzedCommitRow, error)
12}
13
14func MaybeNullObjectCommitRepository(target ent.MappedDiffTarget) Committer {
15	c, err := repositories.NewCommitRepository(target)
16	if err != nil {
17		return repositories.NewNullObject(err)
18	}
19	return c
20}
21