githubsearch

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorUnableToListAllResult = errors.New("unable to list all results")

Functions

This section is empty.

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

func PerPage

func PerPage(perPage int) Option

PerPage will set how many results will per requested per page for each search query.

type Searcher

type Searcher struct {
	// contains filtered or unexported fields
}

func NewSearcher

func NewSearcher(ctx context.Context, client *graphql.Client, logger *zap.Logger, options ...Option) *Searcher

func (*Searcher) ReposByStars

func (re *Searcher) ReposByStars(baseQuery string, minStars, overlap int, emitter func(string)) error

ReposByStars will call emitter once for each repository returned when searching for baseQuery with at least minStars, order from the most stars, to the least.

The emitter function is called with the repository's Url.

The algorithm works to overcome the approx 1000 repository limit returned by a single search across 10 pages by: - Ordering GitHub's repositories from most stars to least. - Iterating through all the repositories returned by each query. - Getting the number of stars for the last repository returned. - Using this star value, plus an overlap, to be the maximum star limit.

The algorithm fails if the last star value plus overlap has the same or larger value as the previous iteration.

Jump to

Keyboard shortcuts

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