func search(ctx context.Context, log *logrus.Entry, ghc githubClient, q string) ([]PullRequest, error) {
	var ret []PullRequest
	vars := map[string]interface{}{
		"query":        githubql.String(q),
		"searchCursor": (*githubql.String)(nil),
	}
	var totalCost int
	var remaining int
	for {
		sq := SearchQuery{}
		log.Infof("query \"%s\" ", q)
		if err := ghc.Query(ctx, &sq, vars); err != nil {
			return nil, err
		}
		totalCost += int(sq.RateLimit.Cost)
		remaining = int(sq.RateLimit.Remaining)
		for _, n := range sq.Search.Nodes {
			ret = append(ret, n.PullRequest)
		}
		if !sq.Search.PageInfo.HasNextPage {
			break
		}
		vars["searchCursor"] = githubql.NewString(sq.Search.PageInfo.EndCursor)
	}
	log.Infof("Search for query \"%s\" cost %d point(s). %d remaining.", q, totalCost, remaining)
	return ret, nil
}
// Executes the search query contained in q using the GitHub client ghc
Executes the search query contained in q using the GitHub client ghc
// Executes the search query contained in q using the GitHub client ghc
func search(ctx context.Context, log *logrus.Entry, ghc githubClient, q string) ([]PullRequest, error) {
	var ret []PullRequest
	vars := map[string]interface{}{
		"query":        githubql.String(q),
		"searchCursor": (*githubql.String)(nil),
	}
	var totalCost int
	var remaining int
	for {
		sq := SearchQuery{}
		log.Infof("query \"%s\" ", q)
		if err := ghc.Query(ctx, &sq, vars); err != nil {
			return nil, err
		}
		totalCost += int(sq.RateLimit.Cost)
		remaining = int(sq.RateLimit.Remaining)
		for _, n := range sq.Search.Nodes {
			ret = append(ret, n.PullRequest)
		}
		if !sq.Search.PageInfo.HasNextPage {
			break
		}
		vars["searchCursor"] = githubql.NewString(sq.Search.PageInfo.EndCursor)
	}
	log.Infof("Search for query \"%s\" cost %d point(s). %d remaining.", q, totalCost, remaining)
	return ret, nil
}
func search ( ctx context . Context , log * logrus . Entry , ghc githubClient , q string ) ( [ ] PullRequest , error ) { var ret [ ] PullRequest vars := map [ string ] interface { } { " " : githubql . String ( q ) , " " : ( * githubql . String ) ( nil ) , } var totalCost int var remaining int for { sq := SearchQuery { } log . Infof ( " \" \" " , q ) if err := ghc . Query ( ctx , & sq , vars ) ; err != nil { return nil , err } totalCost += int ( sq . RateLimit . Cost ) remaining = int ( sq . RateLimit . Remaining ) for _ , n := range sq . Search . Nodes { ret = append ( ret , n . PullRequest ) } if ! sq . Search . PageInfo . HasNextPage { break } vars [ " " ] = githubql . NewString ( sq . Search . PageInfo . EndCursor ) } log . Infof ( " \" \" " , q , totalCost , remaining ) return ret , nil }
Executes the search query contained in q using the GitHub client ghc
Executes the search query contained in q using the GitHub client ghc