Documentation
¶
Index ¶
Constants ¶
View Source
const ( ProviderSogou = "sogou" ProviderBaidu = "baidu" ProviderQuark = "quark" ProviderBing = "bing" ProviderDuckDuckGo = "duckduckgo" )
Variables ¶
View Source
var ErrNoResults = errors.New("no web search results found")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Timeout time.Duration
MaxResults int
Language string
SafeSearch int
SafeSearchSet bool
Providers []string
Quick bool
HTTPClient *http.Client
// ProviderBaseURLs is intended for tests and private deployments that need
// to point a built-in provider at a controlled compatible endpoint.
ProviderBaseURLs map[string]string
}
type SearchRequest ¶
type SearchRequest struct {
Query string
}
type SearchResponse ¶
type SearchResponse struct {
Query string `json:"query"`
Provider string `json:"provider,omitempty"`
Results []Result `json:"results"`
}
func Search ¶
func Search(ctx context.Context, cfg Config, req SearchRequest) (SearchResponse, error)
Click to show internal directories.
Click to hide internal directories.