Documentation
¶
Overview ¶
Package infrastructure holds the maintenance adapters: the store-backed PR repository and the GitHub PR-state checker, each implementing a maintenance domain port.
Index ¶
- type GitHubChecker
- type PRRepository
- func (r *PRRepository) Delete(ctx context.Context, repository string, prNumber int) error
- func (r *PRRepository) DeleteStaleBefore(ctx context.Context, cutoff time.Time) (int64, error)
- func (r *PRRepository) ListOpen(ctx context.Context) ([]domain.PRRow, error)
- func (r *PRRepository) MarkClosed(ctx context.Context, repository string, prNumber int) error
- type PRStateGetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitHubChecker ¶
type GitHubChecker struct {
// contains filtered or unexported fields
}
GitHubChecker adapts the GitHub client to domain.PRChecker: it splits "owner/repo" and reports whether the PR's state is "open". A 404 maps to domain.ErrPRNotFound and a draft PR (any state) to domain.ErrPRDraft, so the reconciler can drop either from the digest; any other API error is propagated verbatim, so the reconciler leaves the row untouched rather than wrongly acting on a PR it could not read (e.g. a transient 5xx).
func NewGitHubChecker ¶
func NewGitHubChecker(gh PRStateGetter) *GitHubChecker
NewGitHubChecker wraps a GitHub client.
type PRRepository ¶
type PRRepository struct {
// contains filtered or unexported fields
}
PRRepository adapts the store's PullRequests repository to the maintenance domain ports (StaleMessageDeleter, OpenLister, Closer, Deleter). It maps store persistence models to maintenance domain DTOs at the boundary, so no gorm-tagged type ever crosses a port.
func NewPRRepository ¶
func NewPRRepository(pullRequests *persistence.PullRequests) *PRRepository
NewPRRepository wraps the store's PullRequests repository.
func (*PRRepository) DeleteStaleBefore ¶
DeleteStaleBefore implements domain.StaleMessageDeleter.
func (*PRRepository) ListOpen ¶
ListOpen implements domain.OpenLister, mapping store rows to domain PRRows.
func (*PRRepository) MarkClosed ¶
MarkClosed implements domain.Closer.
type PRStateGetter ¶
type PRStateGetter interface {
GetPullRequest(ctx context.Context, owner, repo string, number int) (github.PullRequestState, error)
}
PRStateGetter is the slice of the GitHub client the checker needs.