Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaintainCase ¶ added in v0.2.0
func MaintainCase() func(configurer)
Types ¶
type CachedSearcher ¶
type CachedSearcher struct {
// contains filtered or unexported fields
}
func WithCache ¶
func WithCache(s Searcher) *CachedSearcher
func (*CachedSearcher) WithCache ¶
func (cs *CachedSearcher) WithCache(f func(cache map[string]*CachedPackage))
type HTTPSearcher ¶
type HTTPSearcher struct {
// contains filtered or unexported fields
}
HTTPSearcher provides an interface to search the godocs package module page. It implements the Searcher interface. A parser must be provided, such as pkgsite.Parser, or godoc.Parser.
HTTPSearcher does not cache results and will do the request every time, even if provided the same module name. If caching is required, the CachedSearcher type.
func (HTTPSearcher) Search ¶
Search searches godocs for the provided module.
SearchContext is the main workhorse for querying and parsing the http response. The implementation for parsing the document can be found in parse.go
If the page does not respond with a 200 status code, a InvalidStatusError is returned. If the page could not be parsed by GoQuery, the error will be of type Otherwise, issues while parsing the document will of type ParseError, and will contain the selector being parsed, for more context.
type InvalidStatusError ¶
type InvalidStatusError int
InvalidStatusError indicates that the request to the godocs.io was not successful. The value is the status that was returned from the page instead.
func (InvalidStatusError) Error ¶
func (err InvalidStatusError) Error() string
Error satisfies the error interface.
type Parser ¶
type Parser interface { URL(module string) (full string) Parse(document *goquery.Document, useCase bool) (Package, error) }
Parser is the interface that package site parsers implement.