internal/store/commitrefs.go
15 lines · 497 bytes
1 symbol in this file
1package store
2
3// TryRecordCommitRef marks a commit as having referenced an issue. It
4// reports whether this pair was new — false means the reference was
5// already processed and must not act again.
6func (s *Store) TryRecordCommitRef(issueID int64, sha string) (bool, error) {
7 res, err := s.DB.Exec(
8 "INSERT INTO issue_commit_refs (issue_id, sha) VALUES (?, ?) ON CONFLICT DO NOTHING",
9 issueID, sha)
10 if err != nil {
11 return false, err
12 }
13 n, _ := res.RowsAffected()
14 return n > 0, nil
15}