Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions internal/searcher/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func Client() *client {
}
}

func (c *client) Search(query string, options ...func() string) (*SearchResult, error) {
func (c *client) Search(query string, options ...SearchOption) (*SearchResult, error) {
if query == "" {
return nil, fmt.Errorf("query should not be empty")
}
Expand All @@ -50,7 +50,10 @@ func (c *client) Search(query string, options ...func() string) (*SearchResult,
return execSearch(searchURL)
}

func WithVersion(version string) func() string {
// SearchOption returns a string for query to be appended to the endpoint
type SearchOption func() string

func WithVersion(version string) SearchOption {
return func() string {
return "&v=" + url.QueryEscape(version)
}
Expand Down