Help us shape the future of Go! Take the 2026 Go Developer Survey

web

package
v1.233.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultHTTPTimeout is the default timeout for HTTP requests.
	DefaultHTTPTimeout = 30 * time.Second
	// DefaultMaxResults is the default maximum number of search results.
	DefaultMaxResults = 10
	// DuckDuckGoMaxResults is the maximum number of results for DuckDuckGo.
	DuckDuckGoMaxResults = 50
	// GoogleMaxResults is the maximum number of results for Google CSE API.
	GoogleMaxResults = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DuckDuckGoEngine

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

DuckDuckGoEngine implements search using DuckDuckGo HTML.

func NewDuckDuckGoEngine

func NewDuckDuckGoEngine() *DuckDuckGoEngine

NewDuckDuckGoEngine creates a new DuckDuckGo search engine.

func (*DuckDuckGoEngine) Search

func (e *DuckDuckGoEngine) Search(ctx context.Context, query string, maxResults int) (*SearchResponse, error)

Search performs a DuckDuckGo HTML search.

type GoogleEngine

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

GoogleEngine implements search using Google Custom Search API.

func NewGoogleEngine

func NewGoogleEngine(apiKey, cseID string) *GoogleEngine

NewGoogleEngine creates a new Google Custom Search engine.

func (*GoogleEngine) Search

func (e *GoogleEngine) Search(ctx context.Context, query string, maxResults int) (*SearchResponse, error)

Search performs a Google Custom Search.

type SearchEngine

type SearchEngine interface {
	Search(ctx context.Context, query string, maxResults int) (*SearchResponse, error)
}

SearchEngine represents a search engine implementation.

func NewSearchEngine

func NewSearchEngine(atmosConfig *schema.AtmosConfiguration) SearchEngine

NewSearchEngine creates a search engine based on configuration.

type SearchResponse

type SearchResponse struct {
	Query   string         `json:"query"`
	Results []SearchResult `json:"results"`
	Count   int            `json:"count"`
}

SearchResponse contains search results.

type SearchResult

type SearchResult struct {
	Title       string `json:"title"`
	URL         string `json:"url"`
	Description string `json:"description"`
}

SearchResult represents a single search result.

Jump to

Keyboard shortcuts

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