search

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package search implements Google Custom Search.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Title string
}

Context is from Google custom search API JSON result.

type Information added in v1.0.4

type Information struct {
	SearchTime            float64
	FormattedSearchTime   string
	TotalResults          string
	FormattedTotalResults string
}

Information is from Google custom search API JSON result.

type Item

type Item struct {
	Kind, Title, HTMLTitle         string
	Link, DisplayLink              string
	Snippet, HTMLSnippet, CacheID  string
	FormattedURL, HTMLFormattedURL string
}

Item is from Google custom search API JSON result.

func (*Item) String

func (i *Item) String() string

type Page

type Page struct {
	Title, TotalResults, SearchTerms string
	Count, StartIndex                int
	InputEncoding, OutputEncoding    string
	Safe, Cx                         string
}

Page is from Google custom search API JSON result.

type Queries

type Queries struct {
	NextPage, Request []Page
}

Queries is from Google custom search API JSON result.

type Result

type Result struct {
	Kind              string
	URL               URL
	Queries           Queries
	Context           Context
	SearchInformation Information
	Items             []Item
}

Result is from Google custom search API JSON result.

func Search(term, key, cx string) (*Result, error)

Search searches a term on Google Custom Search and returns a Result. It requires a Google API Key (key) and a Google Custom Search ID (cx).

type URL added in v1.0.4

type URL struct {
	Type, Template string
}

URL is from Google custom search API JSON result.

Directories

Path Synopsis
Google Custom Search client.
Google Custom Search client.

Jump to

Keyboard shortcuts

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