Documentation
¶
Overview ¶
Package explore turns what the user types in Explore into one GitHub search for open pull requests to help on.
Index ¶
Constants ¶
const DefaultSort = "updated-asc"
DefaultSort puts the pull request that has waited longest first, so whoever asked earlier is not pushed further back.
const MaxFallbackRepos = 50
MaxFallbackRepos bounds the repositories an author's search is retried in.
const MaxOwners = 10
MaxOwners bounds the owners free text is scoped to.
const MaxResults = 30
MaxResults is one page: 100 breaks GitHub's per-query resource limit with the candidate fragment, 50 doubles the cost for results nobody scans.
Variables ¶
This section is empty.
Functions ¶
func AuthorInRepos ¶
AuthorInRepos is login's search again, split by repository: GitHub search hides some accounts' pull requests unless repo: scopes it.
Types ¶
type Lookup ¶
type Lookup struct {
Repos []string // owner/name of the repositories the inventory holds
Owners []string // their owners, the most relevant first
// IsUser answers whether a word is a GitHub user's login; nil, or an
// error, reads the word as text.
IsUser func(ctx context.Context, login string) (bool, error)
}
Lookup is what the inventory and GitHub tell Explore about a bare word.
type Request ¶
type Request struct {
Ref *github.Ref
Query string
Read string // how the input was read, after "as"
Author string // the login when the search lists one author's pull requests
Team string // org/slug when the search lists what one team is asked to review
Sort string // the value of the search's sort: qualifier
// Keep are the updated: qualifiers, which every search of the request
// carries, the fallback's too.
Keep []string
}
Request is one pull request when Ref is set, else a search.
type Retry ¶
Retry bounds each attempt of a search and pauses before its second try.
func (Retry) AuthorInRepos ¶
func (r Retry) AuthorInRepos(ctx context.Context, s Searcher, queries []string, sort, viewer string) (merged dgh.CandidatePage, failed []error, err error)
AuthorInRepos runs the searches SearchesPerRequest to a request and merges them in the order sort asks for; failed holds the searches that failed alone, and only all of them failing fails the merge.
type Searcher ¶
type Searcher interface {
SearchCandidates(ctx context.Context, q, viewer string, first int) (dgh.CandidatePage, error)
SearchCandidatesEach(ctx context.Context, qs []string, viewer string, first int) ([]dgh.CandidatePage, []error, error)
CandidateByRef(ctx context.Context, ref github.Ref, viewer string) (dgh.CandidatePage, error)
}
Searcher is the GitHub search Explore runs.