internal

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoGoodResult = errors.New("no good search results found")
	ErrAPIResponse  = errors.New("duckduckgo api responded with error")
)

Functions

This section is empty.

Types

type Client

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

Client defines an HTTP client for communicating with duckduckgo.

func New

func New(maxResults int, userAgent string) *Client

New initializes a Client with arguments for setting a max results per search query and a value for the user agent header.

func (*Client) Search

func (client *Client) Search(ctx context.Context, query string) (string, error)

Search performs a search query and returns the result as string and an error if any.

func (*Client) SetMaxResults

func (client *Client) SetMaxResults(n int)

type Result

type Result struct {
	Title string
	Info  string
	Ref   string
}

Result defines a search query result type.

Jump to

Keyboard shortcuts

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