explore

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: Apache-2.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package explore turns what the user types in Explore into one GitHub search for open pull requests to help on.

Index

Constants

View Source
const DefaultSort = "updated-asc"

DefaultSort puts the pull request that has waited longest first, so whoever asked earlier is not pushed further back.

View Source
const MaxFallbackRepos = 50

MaxFallbackRepos bounds the repositories an author's search is retried in.

View Source
const MaxOwners = 10

MaxOwners bounds the owners free text is scoped to.

View Source
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

func AuthorInRepos(login string, repos []string, sort string, keep []string) []string

AuthorInRepos is login's search again, split by repository: GitHub search hides some accounts' pull requests unless repo: scopes it.

func Order

func Order(sort string) func(a, b dgh.Candidate) int

Order compares candidates as GitHub's sort does, nil for a sort it cannot tell from a candidate.

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.

func Parse

func Parse(ctx context.Context, input string, l Lookup) (Request, error)

type Retry

type Retry struct {
	Attempt, Pause time.Duration
}

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.

func (Retry) Search

func (r Retry) Search(ctx context.Context, s Searcher, q, viewer string) (dgh.CandidatePage, error)

Search gives a search GitHub could not finish in time one more try after a pause: a gateway error or a timeout often passes.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL