search

package
v0.0.0-...-3f48b55 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Display

func Display(results chan *Result)

Diaplay从每个单独的goroutine接收到结果后,在终端窗口输出

func Match

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

Match函数,为每个数据源单独启动goroutine来执行这个函数 并发地执行搜索

func Register

func Register(feedType string, matcher Matcher)

Register调用时,会注册一个匹配器,提供给后面的程序使用

func Run

func Run(searchTerm string)

Types

type Feed

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

Feed包含需要处理的数据源消息

func RetrieveFeeds

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

读取并反序列化源数据文件

type Matcher

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

定义了要实现的新搜索类型的行为

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