search

package
v0.0.0-...-6310a18 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Display

func Display(results chan *Result)

Display writes results to the console window as they are received by the individual goroutines.

func Match

func Match(feed *Feed, matcher Matcher, searchTerm string, results chan<- *Result)

Match is launched as a goroutine for each individual feed to run searches concurrently.

func Register

func Register(feedType string, matcher Matcher)

Register is called to register a matcher for use by the program.

func Run

func Run(searchTerm string)

Run perform the search logic. - 执行搜索逻辑

Types

type Feed

type Feed struct {
	Name string `json:"site"`
	URI  string `json:"link"`
	Type string `json:"type"`
}

Feed contains information we need to process a feed

func RetrieveFeeds

func RetrieveFeeds() ([]*Feed, error)

RetrieveFeeds reads and unmarshals the feed data file. - 解析、反序列化源数据文件

type Matcher

type Matcher interface {
	Search(feed *Feed, searchTerm string) ([]*Result, error)
}

Matcher defines the behavior required by types that want to implement a new search type

type Result

type Result struct {
	Field   string
	Content string
}

Jump to

Keyboard shortcuts

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