Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CachedSearcher ¶
type CachedSearcher interface {
Searcher
// WithCache gives access to modify and update the contents of the internal cache.
WithCache(func(cache map[string]*CachedPackage))
}
func NewCachedSearcher ¶ added in v1.0.0
func NewCachedSearcher(parser Parser, opts ...SearchOption) CachedSearcher
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 Package ¶
type Package struct {
URL string `json:"url"`
Name string `json:"name"`
Overview Comment `json:"overview"`
Examples []Example `json:"examples"`
Constants []Variable `json:"constants"`
Variables []Variable `json:"variables"`
ConstantMap map[string]Variable `json:"constant_map"`
VariableMap map[string]Variable `json:"variable_map"`
Functions map[string]Function `json:"functions"`
Types map[string]Type `json:"types"`
Subpackages []string `json:"subpackages"`
}
type Parser ¶
type Parser interface {
URL(module string) (full string)
Parse(document *goquery.Document, useCase, dupeTypeFuncs bool) (Package, error)
}
Parser is the interface that package site parsers implement.
type SearchOption ¶ added in v1.0.0
type SearchOption = func(s *httpSearcher)
func MaintainCase ¶ added in v0.2.0
func MaintainCase() SearchOption
func UserAgent ¶
func UserAgent(agent string) SearchOption
func WithClient ¶ added in v1.0.0
func WithClient(client *http.Client) SearchOption
func WithDuplicateTypeFuncs ¶ added in v1.2.0
func WithDuplicateTypeFuncs() SearchOption
type Searcher ¶
type Searcher interface {
// Search will find a package with the module name.
Search(ctx context.Context, module string) (Package, error)
}
func NewSearcher ¶ added in v1.0.0
func NewSearcher(parser Parser, opts ...SearchOption) Searcher
Click to show internal directories.
Click to hide internal directories.